Skip to contentSkip to conversation

ax25: cleanup a range test

PATCH Applied Dan Carpenter 2 participants 2 messages Oct 18, 2013

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

PATCH 1/1 ax25: cleanup a range test

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.

net/ax25/af_ax25.c +1 -1
index 4b4d2b7..a00123e 100644
@@ -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;
 		}
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Fri, 18 Oct 2013 12:06:56 +0300

Quoted 6 lines

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.

Applied to net-next, thanks Dan.