Skip to contentSkip to conversation

net/core/sock.c: quiet sparse noise

PATCH Applied H Hartley Sweeten 2 participants 2 messages Jan 15, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/core/sock.c: quiet sparse noise

net/core/sock.c: quiet sparse noise

In sock_getsockopt the symbol 'lv' is declared as an unsigned int type, probably due to sizeof returning a size_t which is really an unsigned int.

This produces a sparse warning for SO_PEERNAME due to the sock->ops->getname() call:

warning: incorrect type in argument 3 (different signedness)
expected int *sockaddr_len
got unsigned int *<noident>

Quiet the warning my changing the type of 'lv' to an int.

---

net/core/sock.c +1 -1
index e1f6f22..10b1d32 100644
@@ -741,7 +741,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
 		struct timeval tm;
 	} v;
 
-	unsigned int lv = sizeof(int);
+	int lv = sizeof(int);
 	int len;
 
 	if (get_user(len, optlen))
maintainer Applied
#1 lore raw

From: H Hartley Sweeten <[email protected]>
Date: Thu, 14 Jan 2010 17:21:45 -0700

Quoted 9 lines

net/core/sock.c: quiet sparse noise

In sock_getsockopt the symbol 'lv' is declared as an unsigned int type, probably due to sizeof returning a size_t which is really an unsigned int.

This produces a sparse warning for SO_PEERNAME due to the sock->ops->getname() call:

Quoted 7 lines

warning: incorrect type in argument 3 (different signedness)
expected int *sockaddr_len
got unsigned int *<noident>

Quiet the warning my changing the type of 'lv' to an int.

Applied to net-next-2.6, thanks.