RDMA/rxe: Return CQE error if invalid lkey was supplied
[linux-2.6-microblaze.git] / drivers / i2c / i2c-dev.c
index 6ceb11c..6ef38a8 100644 (file)
@@ -440,8 +440,13 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                                   sizeof(rdwr_arg)))
                        return -EFAULT;
 
-               /* Put an arbitrary limit on the number of messages that can
-                * be sent at once */
+               if (!rdwr_arg.msgs || rdwr_arg.nmsgs == 0)
+                       return -EINVAL;
+
+               /*
+                * Put an arbitrary limit on the number of messages that can
+                * be sent at once
+                */
                if (rdwr_arg.nmsgs > I2C_RDWR_IOCTL_MAX_MSGS)
                        return -EINVAL;