[OpenAFS-devel] Possible bug rx_getaddr.c with memset

Marcus Watts mdw@umich.edu
Wed, 11 Oct 2006 17:29:09 -0400


Mark Huijgen <mark@nl.simpc.com> writes:
...
>              memset(&ifr, sizeof(ifr), 0);
...

Well, it's wrong, and certainly deserves a fix.
Probably you should submit a patch via the web page & "RT".

It's probably not breaking anything too badly -- yet.  Writing 0 bytes
is silly, but harmless.  A smart compiler might even optimize it out
entirely.  In linux, it appears to me that ioctl(,SIOCGIFMTU ignores
everything but for ifr_name - I'm not sure it even cares about
ifr_addr.sa_family.  Failing to zero ifr means the ioctl might see junk
- if it actually cares, then it will fail - and set the MTU to 1500,
which is probably workable.  Correctly discovering a larger MTU is
mainly helpful on the local subnet if one hopes to actually use
jumbograms.

Have you looked for more things like this?

I wonder if valgrind is smart enough to catch problems with passing
uninitialized data to the kernel?

			-Marcus Watts