Netdev List
 help / color / mirror / Atom feed
* [PATCH 29/42] isdn: mISDN: socket: Fix set-but-unused variables.
@ 2011-04-18  0:33 David Miller
  0 siblings, 0 replies; only message in thread
From: David Miller @ 2011-04-18  0:33 UTC (permalink / raw)
  To: netdev


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.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/isdn/mISDN/socket.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
index 7446d8b..8e32522 100644
--- a/drivers/isdn/mISDN/socket.c
+++ b/drivers/isdn/mISDN/socket.c
@@ -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)
-- 
1.7.4.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-18  0:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18  0:33 [PATCH 29/42] isdn: mISDN: socket: Fix set-but-unused variables David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox