mirror of
https://github.com/torvalds/linux.git
synced 2026-12-04 20:34:05 +00:00
The return value of sg_nents_for_len was assigned to an unsigned long
in starfive_hash_digest, causing negative error codes to be converted
to large positive integers.
Add error checking for sg_nents_for_len and return immediately on
failure to prevent potential buffer overflows.
Fixes: 7883d1b28a ("crypto: starfive - Add hash and HMAC support")
Signed-off-by: Haotian Zhang <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>