> 
> Allocating 1K on the stack is indeed evil.

Why would you say evil ? I didnt quite get why you meant by that. Is it
at some extremes ? 1K is from the default ubuntu 14.04 config.
> 
>> abx500-core.c had an object of struct device being allocated on stack. So
>> dynamically allocating it makes the warning go away. Are there any
>> implications on using dynamic allocation on this particular code?
> 
> He probably didn't realize or didn't know better.
> 
> Having said that:
> 
>> +    dummy_child = kzalloc(sizeof(struct device),GFP_KERNEL);
> 
> There's no kfree() for this. So you introduced a memory leak.

My bad! "I successfully operated the patient, but forgot the scissors
inside", :D Thanks for pointing out! :)
> 
>>      list_for_each_entry(dev_entry, &abx500_list, list) {
>> -            dummy_child.parent = dev_entry->dev;
>> +            dummy_child->parent = dev_entry->dev;
>>              ops = &dev_entry->ops;
>>
>>              if ((ops != NULL) && (ops->dump_all_banks != NULL))
>> -                    ops->dump_all_banks(&dummy_child);
>> +                    ops->dump_all_banks(dummy_child);
>>      }
> 
>       kfree(dummy_child); /* should go here... */
>>  }
>>  EXPORT_SYMBOL(abx500_dump_all_banks);
> 
> The weird part is that the entries on abx500_list apparently don't
> have valid ->parent pointers already, so we have have to invent dummy ones.
> 
> Anybody understand why that's the case?  This smells like we're not fixing
> the actual problem here, just changing the way we paper it over to be a less
> ugly papering over....
> 
> 
Waiting to hear from the experts!
> 
> _______________________________________________
> Kernelnewbies mailing list
> [email protected]
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to