netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ax25: cleanup a range test
@ 2013-10-18  9:06 Dan Carpenter
  2013-10-18 17:56 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-10-18  9:06 UTC (permalink / raw)
  To: Joerg Reuter
  Cc: Ralf Baechle, David S. Miller, linux-hams, netdev,
	kernel-janitors

The current test works fine in practice.  The "amount" variable is
actually used as a boolean so negative values or any non-zero values
count as "true".  However since we don't allow numbers greater than one,
let's not allow negative numbers either.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 4b4d2b7..a00123e 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1735,7 +1735,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 			res = -EFAULT;
 			break;
 		}
-		if (amount > AX25_NOUID_BLOCK) {
+		if (amount < 0 || amount > AX25_NOUID_BLOCK) {
 			res = -EINVAL;
 			break;
 		}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] ax25: cleanup a range test
  2013-10-18  9:06 [patch] ax25: cleanup a range test Dan Carpenter
@ 2013-10-18 17:56 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-10-18 17:56 UTC (permalink / raw)
  To: dan.carpenter; +Cc: jreuter, ralf, linux-hams, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 18 Oct 2013 12:06:56 +0300

> The current test works fine in practice.  The "amount" variable is
> actually used as a boolean so negative values or any non-zero values
> count as "true".  However since we don't allow numbers greater than one,
> let's not allow negative numbers either.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to net-next, thanks Dan.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-18 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-18  9:06 [patch] ax25: cleanup a range test Dan Carpenter
2013-10-18 17:56 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).