Browse Source

wusb: fix error return code in wusb_prf()

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>
Wei Yongjun 8 năm trước cách đây
mục cha
commit
1ee1710cd6
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      drivers/usb/wusbcore/crypto.c

+ 3 - 1
drivers/usb/wusbcore/crypto.c

@@ -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++);