Uninitialized variable

Richard B. Johnson (root@analogic.com)
Sun, 2 Mar 1997 19:55:08 -0500 (EST)


I found the following potential bug in linux/net/core/sock.c: 'err' was
never initialized, plus the code section seemed to have been 'plugged-in'
from somewhere else. It didn't follow the same logic as other entries in
the switch(). BTW. It doesn't seem to fix anything, but nobody sets
sockets to "linger" anymore, they just close 'em... Maybe "socket destroy
messages?" ..Nah. too lucky if true.
---------------------------

--- /usr/src/linux/net/core/sock.c.orig Sun Mar 2 19:43:18 1997
+++ /usr/src/linux/net/core/sock.c Sun Mar 2 19:33:22 1997
@@ -327,20 +327,14 @@
break;

case SO_LINGER:
- {
- int err;
len=min(len,sizeof(ling));
- if (put_user(len, optlen))
- if (!err) {
- ling.l_onoff=sk->linger;
- ling.l_linger=sk->lingertime;
- err = copy_to_user(optval,&ling,len);
- if (err)
- err = -EFAULT;
- }
- return err;
- }
-
+ if(put_user(len, optlen))
+ return -EFAULT;
+ ling.l_onoff=sk->linger;
+ ling.l_linger=sk->lingertime;
+ if(copy_to_user(optval,&ling,len))
+ return -EFAULT;
+ return 0;
case SO_BSDCOMPAT:
val = sk->bsdism;
break;

-----------------------------

Cheers,
Dick Johnson
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard B. Johnson
Project Engineer
Analogic Corporation
Voice : (508) 977-3000 ext. 3754
Fax : (508) 532-6097
Modem : (508) 977-6870
Ftp : ftp@boneserver.analogic.com
Email : rjohnson@analogic.com, johnson@analogic.com
Penguin : Linux version 2.1.27 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-