lkml.org 
[lkml]   [2002]   [Jan]   [2]   [last100]   RSS-feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Complete thread (EXPERIMENTAL)
/
SubjectRe: [PATCH] C undefined behavior fix
FromMomchil Velikov <>
Date02 Jan 2002 12:41:28 +0200
Digg This
"Florian" == Florian Weimer <fw@deneb.enyo.de> writes:

Florian> Momchil Velikov <velco@fadata.bg> 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.
Regards,
-velco
\
ISP Services
Valid XHTML 1.0!\ /
Valid CSS! Last update: 2005-03-22 12:15    [W:0.477 / U:0.770 seconds]
©2003-2005 Jasper Spaans