wusb: fix error return code in wusb_prf()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 19 Oct 2016 13:19:02 +0000 (13:19 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Oct 2016 13:28:29 +0000 (15:28 +0200)
Fix to return error code -ENOMEM from the kmalloc() error handling
case instead of 0, as done elsewhere in this function.

Fixes: a19b882c07a6 ("wusb: Stop using the stack for sg crypto scratch space")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/wusbcore/crypto.c

index de089f3a82f3dc9767cac24a6702219df0d6514b..79451f7ef1b76301cc881379ad28ce12e4b4dc33 100644 (file)
@@ -339,8 +339,10 @@ ssize_t wusb_prf(void *out, size_t out_size,
                goto error_setkey_aes;
        }
        scratch = kmalloc(sizeof(*scratch), GFP_KERNEL);
-       if (!scratch)
+       if (!scratch) {
+               result = -ENOMEM;
                goto error_alloc_scratch;
+       }
 
        for (bitr = 0; bitr < (len + 63) / 64; bitr++) {
                sfn_le = cpu_to_le64(sfn++);