Re: [PATCH] C undefined behavior fix

From: Momchil Velikov (
Date: Wed Jan 02 2002 - 05:41:28 EST

>>>>> "Florian" == Florian Weimer <> writes:

Florian> Momchil Velikov <> writes:
>> - strcpy(namep, RELOC("linux,phandle"));
>> + memcpy (namep, RELOC("linux,phandle"), sizeof("linux,phandle"));

Florian> Doesn't this still trigger undefined behavior, as far as the C
Florian> standard is concerned? It's probably a better idea to fix the linker,
Florian> so that it performs proper relocation.

Well, strictly speaking it _is_ undefined, however adding/subtracting
__PAGE_OFFSET is far too common operation and one can resonably expect
to get away with it in the _vast_ majority of cases. IMHO, it is
better to fix the particular case, which triggers the undefined
behaviour, as these cases are bound to be _very_ rare.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Jan 07 2002 - 21:00:16 EST