All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2] crypto: img-hash - shift wrapping bug in img_hash_hw_init()
@ 2015-03-20 14:21 ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2015-03-20 14:21 UTC (permalink / raw)
  To: Herbert Xu, James Hartley; +Cc: David S. Miller, linux-crypto, kernel-janitors

"hdev->req->nbytes" is an unsigned int so we so we lose the upper 3
bytes to the shift wrap bug.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index 601ab35..ad47d0d 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);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-23 11:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 14:21 [patch 2/2] crypto: img-hash - shift wrapping bug in img_hash_hw_init() Dan Carpenter
2015-03-20 14:21 ` Dan Carpenter
2015-03-20 18:55 ` James Hartley
2015-03-23 11:03   ` [patch 2/2 v2] " Dan Carpenter
2015-03-23 11:03     ` Dan Carpenter
2015-03-23 11:09     ` Herbert Xu
2015-03-23 11:09       ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.