From: Dan Carpenter Date: Mon, 23 Mar 2015 11:03:55 +0000 (+0300) Subject: crypto: img-hash - shift wrapping bug in img_hash_hw_init() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a83034f5cb135bceb5b23dce1746ef2d98c68234;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git crypto: img-hash - shift wrapping bug in img_hash_hw_init() "hdev->req->nbytes" is an unsigned int so we so we lose the upper 3 bits to the shift wrap bug. Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c index 601ab357f661..ad47d0d61098 100644 --- a/drivers/crypto/img-hash.c +++ b/drivers/crypto/img-hash.c @@ -464,7 +464,7 @@ static int img_hash_hw_init(struct img_hash_dev *hdev) img_hash_write(hdev, CR_RESET, CR_RESET_UNSET); img_hash_write(hdev, CR_INTENAB, CR_INT_NEW_RESULTS_SET); - nbits = (hdev->req->nbytes << 3); + nbits = (u64)hdev->req->nbytes << 3; u = nbits >> 32; l = nbits; img_hash_write(hdev, CR_MESSAGE_LENGTH_H, u);