linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] compat_ioctl: fix an underflow issue (harmless)
@ 2013-11-01 10:24 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2013-11-01 10:24 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, kernel-janitors

We cap "nmsgs" at I2C_RDRW_IOCTL_MAX_MSGS (42) but the current code
allows negative values.  It's harmless but it makes my static checker
upset so I've made nsmgs unsigned.

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

diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 5d19acf..2cb2fd2 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -680,7 +680,8 @@ static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd,
 	struct i2c_msg			__user *tmsgs;
 	struct i2c_msg32		__user *umsgs;
 	compat_caddr_t			datap;
-	int				nmsgs, i;
+	u32				nmsgs;
+	int				i;
 
 	if (get_user(nmsgs, &udata->nmsgs))
 		return -EFAULT;

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

only message in thread, other threads:[~2013-11-01 10:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01 10:24 [patch] compat_ioctl: fix an underflow issue (harmless) Dan Carpenter

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).