[lkml]   [1996]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: in_ntoa interesting fault
Letting the chips far where they may, I quote Alan Cox:
>> Well, today I built 2.0.0 (fresh, minus all the evil things I've done over the
>> past year) to get three different numbers. And then I changed them to in_ntoa
>> and what did I get but the first number three times!
>> Do I smell a gcc fart?!
>No. Read the source code carefully this time. in_ntoa uses a static buffer

I realize that now... insufficient caffeine level!

The really interesting thing is seeing how the compiler builds:
printk("fluff %s %s %s\n", in_ntoa(1), in_ntoa(2), in_ntoa(3));

That will print:
fluff (well, maybe I have byte ordering wrong)

The calls to in_ntoa occur "backwards" and all return the same address thanks
to the "static char buffer[16]." This routine smells of a hideous #define
macro (I've done that before) or exploit gcc and create some vars in the
middle of a function. (Or compile the kernel with g++ <grin>)


Gee, look at the trouble I go through to avoid hex IP addresses!

 \ /
  Last update: 2005-03-22 13:37    [W:0.043 / U:6.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site