Skip to content

Commit

Permalink
wusb: fix error return code in wusb_prf()
Browse files Browse the repository at this point in the history
Fix to return error code -ENOMEM from the kmalloc() error handling
case instead of 0, as done elsewhere in this function.

Fixes: a19b882 ("wusb: Stop using the stack for sg crypto scratch space")
Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Wei Yongjun authored and gregkh committed Oct 19, 2016
1 parent 733cbe0 commit 1ee1710
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/wusbcore/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++);
Expand Down

0 comments on commit 1ee1710

Please sign in to comment.