Skip to contentSkip to conversation

isdn: mISDN: socket: Fix set-but-unused variables.

PATCH In review David Miller 1 participant 1 message Apr 18, 2011

Subsystems (2)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 29/42 isdn: mISDN: socket: Fix set-but-unused variables.

The variable 'len' is set but unused in data_sock_getsockopt().

The code should use 'len' to validate that the user's socket option is indeed the right size.

---
 drivers/isdn/mISDN/socket.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/isdn/mISDN/socket.c +3 -0
index 7446d8b..8e32522 100644
@@ -457,6 +457,9 @@ static int data_sock_getsockopt(struct socket *sock, int level, int optname,
 	if (get_user(len, optlen))
 		return -EFAULT;
 
+	if (len != sizeof(char))
+		return -EINVAL;
+
 	switch (optname) {
 	case MISDN_TIME_STAMP:
 		if (_pms(sk)->cmask & MISDN_TIME_STAMP)
Signature · 1 line
1.7.4.3