Cc: "James E.J. Bottomley" <jbottom...@parallels.com>
Signed-off-by: Fabian Frederick <f...@skynet.be>
---
 drivers/scsi/aacraid/commctrl.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index fbcd48d..3d5d6a6 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -517,16 +517,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void 
__user * arg)
                goto cleanup;
        }
 
-       user_srbcmd = kmalloc(fibsize, GFP_KERNEL);
-       if (!user_srbcmd) {
-               dprintk((KERN_DEBUG"aacraid: Could not make a copy of the 
srb\n"));
-               rcode = -ENOMEM;
-               goto cleanup;
-       }
-       if(copy_from_user(user_srbcmd, user_srb,fibsize)){
+       user_srbcmd = memdup_user(user_srb, fibsize);
+       if (IS_ERR(user_srbcmd)) {
                dprintk((KERN_DEBUG"aacraid: Could not copy srb from user\n"));
-               rcode = -EFAULT;
-               goto cleanup;
+               return PTR_ERR(user_srbcmd);
        }
 
        user_reply = arg+fibsize;
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to