Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1587163
| From | Frank Rowand <frowand.list@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC/PATCH] of: Mark property::value as const |
| Date | 2017-02-24 00:30 +0100 |
| Message-ID | <teaZH-8es-1@gated-at.bofh.it> (permalink) |
| References | <taBvr-43Z-1@gated-at.bofh.it> <teaGl-7ZC-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 02/23/17 15:08, Frank Rowand wrote:
> On 02/13/17 18:50, Stephen Boyd wrote:
>> The 'blob' we pass into populate_properties() is marked as const,
>> but we cast that const away when we assign the result of
>> fdt_getprop_by_offset() to pp->value. Let's mark value as const
>> instead, so that code can't mistakenly write to the value of the
>> property that we've so far advertised as const.
>
> Instead of struct property field value being a pointer into the
> FDT, I would rather copy the data to newly allocated memory and
> have value be a pointer to that memory. This is required if we
> want to make /sys/firmware/fdt optional, which would allow us to
> free the memory containing the initial boot FDT.
>
> I also do not want overlay live subtrees to have any pointers
> into the FDT that was used to populate the overlay, so copying
> the data solves that problem also.
>
>
>> Unfortunately, this exposes a problem with the fdt resolver code,
>> where we overwrite the value member of properties of phandles to
>> update them with their final value. Add a comment for now to
>> indicate where we're potentially writing over const data.
>
> Yes, the resolver code needs to adjust phandle values.
>
> I think I can get rid of the resolver modifying the various phandle
> values, and instead just modify the phandle value in struct
> device_node. At the same time, I think I can also remove all
> instances of the phandle properties ('linux,phandle', 'ibm,phandle',
> 'phandle') in the live tree. These properties should not be
> accessed directly by any code outside of the device tree framework
> since the phandle is located in the struct device_node. A quick
> grep does not show any such accesses of the phandle properties,
> but I want to look more closely.
If I remove the various phandle properties from the live tree,
the one place I can not inspect for impact is the live tree that
is exposed at /proc/device-tree/ I do not know whether that is
a problem or not.
-Frank
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC/PATCH] of: Mark property::value as const Stephen Boyd <stephen.boyd@linaro.org> - 2017-02-14 04:00 +0100
Re: [RFC/PATCH] of: Mark property::value as const Rob Herring <robh+dt@kernel.org> - 2017-02-23 14:50 +0100
Re: [RFC/PATCH] of: Mark property::value as const Frank Rowand <frowand.list@gmail.com> - 2017-02-23 21:00 +0100
Re: [RFC/PATCH] of: Mark property::value as const Frank Rowand <frowand.list@gmail.com> - 2017-02-23 22:00 +0100
Re: [RFC/PATCH] of: Mark property::value as const Rob Herring <robh+dt@kernel.org> - 2017-02-23 23:20 +0100
Re: [RFC/PATCH] of: Mark property::value as const Frank Rowand <frowand.list@gmail.com> - 2017-02-24 00:30 +0100
Re: [RFC/PATCH] of: Mark property::value as const Frank Rowand <frowand.list@gmail.com> - 2017-02-23 22:50 +0100
Re: [RFC/PATCH] of: Mark property::value as const Frank Rowand <frowand.list@gmail.com> - 2017-02-24 00:10 +0100
Re: [RFC/PATCH] of: Mark property::value as const Frank Rowand <frowand.list@gmail.com> - 2017-02-24 00:30 +0100
Re: [RFC/PATCH] of: Mark property::value as const Rob Herring <robh+dt@kernel.org> - 2017-02-24 00:40 +0100
csiph-web