[lkml]   [2008]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 0/7] Fixups for duplicate slot names
Alex Chiang wrote:
> * Kenji Kaneshige <>:
>> Hi Alex-san,
>> Thank you for patches!
>> I looked at your patches and it looks good. But I have only one
>> concern about how to allocate/free memory for slot name.
>> With your change, memory region for slot name will be allocated
>> by hotplug *controller* driver and it can be freed using kfree()
>> by hotplug *core* driver (not hotplug controller driver). So all
>> hotplug controller drivers including drivers implemented in the
>> future need to take it into account.
>> I think it will be more robust if we can allocate and free memory
>> in the same component (maybe hotplug core driver in this case).
> Hm, I didn't think this would be a problem. The sequence is:
> - controller allocates memory for slot name
> - if core detects a collision:
> - it frees the name
> - it allocates new memory for name
> - it assigns that memory to the name parameter
> - controller->release will eventually free the name
> So it shouldn't matter if the core frees the original name
> pointer and allocates new memory, because the core will change
> the pointer for the controller.
> This is why I had to change the interface of pci_create_slot()
> from taking a const char *name to a char *name.
> Is there something I'm missing?
> /ac

I'm worrying about the following cases for example:

- hotplug controller driver allocates memory for slot name using
other than kmalloc().

- hotplug controller driver allocates memory for slot name as
a part of another data structure.

Kenji Kaneshige

 \ /
  Last update: 2008-08-11 03:23    [W:0.073 / U:1.336 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site