[PATCH] drivers/of: Constify device_node->name and ->path_component_name

Grant Likely grant.likely at secretlab.ca
Thu Nov 15 09:48:15 EST 2012


On Wed, Nov 14, 2012 at 10:46 PM, Julian Calaby <julian.calaby at gmail.com> wrote:
> Hi Grant,
>
> On Thu, Nov 15, 2012 at 9:42 AM, Grant Likely <grant.likely at secretlab.ca> wrote:
>> On Wed, Nov 14, 2012 at 10:33 PM, David Miller <davem at davemloft.net> wrote:
>>>
>>> You're making other changes here, such as the kstrdup() stuff,
>>> seperate that into another patch.
>>
>> It's part of the same change. The original code was allocating a
>> buffer, saving the pointer in the name field and then modifying it.
>> Making the code to a kstrdup() gets rid of modifying the const buffer.
>
> You should really mention this in the commit log, maybe something like:
>
>
> [PATCH] drivers/of: Constify device_node->name and ->path_component_name
>
> Neither of these should ever be changed once set. Make them const
>
> Also use kstrdup() instead of memcpy() so we don't attempt to modify them.

Yup, will do.

g.


More information about the devicetree-discuss mailing list