Re: Serious locking bug in Linux NFS

Riley Williams (rhw@bigfoot.com)
Sun, 18 Oct 1998 17:49:52 +0100 (GMT)


Hi Miquel.

>> Here is the relevant code:

>> if (lp->addr.s_addr != sin->sin_addr.s_addr)
>> dprintf(L_WARNING, "address mismatch: "
>> "expected %s, got %s\n",
>> inet_ntoa(lp->addr),
>> inet_ntoa(sin->sin_addr));

>> I don't see how it can happen besides a bad compiler/HW.
>> It looks like you may have a compiler/HW.

> No, it's just that you cannot use inet_ntoa twice in a call to
> printf. inet_ntoa returns data in a static buffer. If you call
> it twice, the data from the first time gets overwritten.

In that case, the following ought to work...

>> if (lp->addr.s_addr != sin->sin_addr.s_addr)
>> dprintf(L_WARNING, "address mismatch: "
>> "expected %s, got %s\n",
>> strdup(inet_ntoa(lp->addr)),
>> inet_ntoa(sin->sin_addr));

...but it'll probably leak memory...

Best wishes from Riley.

-
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/