libfdt: Remove un-const-safe fdt_set_header macro

Jon Loeliger jdl at jdl.com
Fri Oct 26 00:49:38 EST 2007


So, like, the other day David Gibson mumbled:
> The fdt_set_header() macro casts an arbitrary pointer into (struct
> fdt_header *) to set fdt header fields.  While we need to change the
> type, so that we can use this macro on the usual (void *) used to
> represent a device tree blob, the current macro also casts away any
> const on the input pointer, which loses an important check.
> 
> This patch replaces the fdt_set_header() macro with a set of inline
> functions, one for each header field which do a similar thing, but
> which won't silently remove const from a given pointer.  This approach
> is also more in keeping with the individual accessor macros we use for
> reading fdt header fields.
> 
> Signed-off-by: David Gibson <david at gibson.dropbear.id.au>

Applied.

jdl



More information about the Linuxppc-dev mailing list