From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: To: David Gibson Subject: Re: libfdt: Remove un-const-safe fdt_set_header macro In-Reply-To: Your message of "Thu, 25 Oct 2007 14:29:38 +1000." <20071025042938.GD24856@localhost.localdomain> References: <20071025042938.GD24856@localhost.localdomain> Date: Thu, 25 Oct 2007 09:49:38 -0500 From: Jon Loeliger Message-Id: Cc: linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Applied. jdl