lkml.org 
[lkml]   [1999]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: Token Ring layer clobbers first byte of saddr
Date
Firstly, many thanks for pointing out a patch for tcpdump 3.4.

> Giuliano Procida writes:
> > This line uses a test for a variable (rii_p) that is not always set when
the
> > byte is clobbered. However, I don't know much about this. In any case,
this
> > cosmetic change should be made:

> rii_p is an automatic variable initialized in its declaration. As
> such it is initialized each time tr_add_rif_info is entered. (K&R 2E,
> section 2.4, v. 5)

Whatever, here's the code:

... rii_p = 0;
...
if(trh->saddr[0] & TR_RII)
{
trh->saddr[0]&=0x7f;
if (((ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8) > 2)
{
rii_p = 1;
}
}

So the byte may be clobbered at the same time as rii_p is zero. If this
is an error case then it might be better to printk and abort early. If
not, the byte should be unclobbered before exit.

Also, there are two exit points to the function, one on a alloc failure
and the other off the end. If the alloc fails the byte is not unclobbered.
OK, I admit this is picky!

Giuliano.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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