From: Dan Carpenter <dan.carpenter@oracle.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
James Hartley <james.hartley@imgtec.com>
Cc: "David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch 2/2] crypto: img-hash - shift wrapping bug in img_hash_hw_init()
Date: Fri, 20 Mar 2015 14:21:44 +0000 [thread overview]
Message-ID: <20150320142144.GB5108@mwanda> (raw)
"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);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
James Hartley <james.hartley@imgtec.com>
Cc: "David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch 2/2] crypto: img-hash - shift wrapping bug in img_hash_hw_init()
Date: Fri, 20 Mar 2015 17:21:44 +0300 [thread overview]
Message-ID: <20150320142144.GB5108@mwanda> (raw)
"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);
next reply other threads:[~2015-03-20 14:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-20 14:21 Dan Carpenter [this message]
2015-03-20 14:21 ` [patch 2/2] crypto: img-hash - shift wrapping bug in img_hash_hw_init() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150320142144.GB5108@mwanda \
--to=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=james.hartley@imgtec.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.