Re: [PATCH 0/7] Fixups for duplicate slot names



* Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>:
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Framework 2.0 array redim unsatisfactory performance
    ... implementation details of Redim, Redim Preserve, and List. ... significantly higher object allocated overhead then List. ... ReDim simply allocates a new ... but I do not even attempt to test its memory ...
    (microsoft.public.dotnet.languages.vb)
  • Re: [patch] [bugfix] loop.c
    ... goal of my patch. ... This is a bugfix for loop.c block driver, as it currently allocates more ... memory then it needs, without any further use. ...
    (Linux-Kernel)
  • Re: CE6.0 Driver Pointer Marshalling - passing pointers out only?
    ... This is an array of pointers to buffers that get set up ... the driver allocates the buffers (via an internal allocation ... routine from its own block of reserved memory). ... So I can map ...
    (microsoft.public.windowsce.platbuilder)
  • Re: CE6.0 Driver Pointer Marshalling - passing pointers out only?
    ... I've got a pretty complex driver I'm porting up at the moment ... This is an array of pointers to buffers that get set up ... the driver allocates the buffers (via an internal allocation ... routine from its own block of reserved memory). ...
    (microsoft.public.windowsce.platbuilder)
  • Re : Re : memory allocation and freeing memory
    ... This means that the caller ... >> never frees memory, and the callee always frees all its ... then the caller allocates it and pass it ... > void ExprDestroy(Expr *expr) { ...
    (comp.lang.c)