diff options
author | David S. Miller <davem@davemloft.net> | 2009-11-06 01:37:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-06 01:37:11 -0500 |
commit | 000ba2e43f33901859fd794bb33c885909d53b3b (patch) | |
tree | 7fe275574bbaadd808fb38a8f24dc93505a0222b /net/core | |
parent | baac8564547ac7f944af1c2e8cc6fdd57f2836a4 (diff) |
net: Fix build warning in sock_bindtodevice().
net/core/sock.c: In function 'sock_setsockopt':
net/core/sock.c:396: warning: 'index' may be used uninitialized in this function
net/core/sock.c:396: note: 'index' was declared here
GCC can't see that all paths initialize index, so just
set it to the default (0) and eliminate the specific
code block that handles the null device name string.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/sock.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 38820eaecd43..76ff58d43e26 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -417,9 +417,8 @@ static int sock_bindtodevice(struct sock *sk, char __user *optval, int optlen) | |||
417 | if (copy_from_user(devname, optval, optlen)) | 417 | if (copy_from_user(devname, optval, optlen)) |
418 | goto out; | 418 | goto out; |
419 | 419 | ||
420 | if (devname[0] == '\0') { | 420 | index = 0; |
421 | index = 0; | 421 | if (devname[0] != '\0') { |
422 | } else { | ||
423 | struct net_device *dev; | 422 | struct net_device *dev; |
424 | 423 | ||
425 | rcu_read_lock(); | 424 | rcu_read_lock(); |