Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev into drm-next
[firefly-linux-kernel-4.4.55.git] / drivers / scsi / aacraid / commctrl.c
index d85ac1a9d2c0698b85c606ab6b2ff917cb0959ed..fbcd48d0bfc3397f2a5b202b093d06bbaa2420a6 100644 (file)
@@ -511,7 +511,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
                goto cleanup;
        }
 
-       if (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr))) {
+       if ((fibsize < (sizeof(struct user_aac_srb) - sizeof(struct user_sgentry))) ||
+           (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)))) {
                rcode = -EINVAL;
                goto cleanup;
        }