* [patch 1/2] crypto: mxc-scc - signedness bugs in mxc_scc_ablkcipher_req_init()
@ 2016-04-22 9:56 Dan Carpenter
2016-04-25 11:22 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-04-22 9:56 UTC (permalink / raw)
To: Herbert Xu, Steffen Trumtrar
Cc: David S. Miller, linux-crypto, kernel-janitors
->src_nents and ->dst_nents are unsigned so they can't be less than
zero. I fixed this by introducing a temporary "nents" variable.
Fixes: d293b640ebd5 ('crypto: mxc-scc - add basic driver for the MXC SCC')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/crypto/mxc-scc.c b/drivers/crypto/mxc-scc.c
index 38b01bf..9b348a7 100644
--- a/drivers/crypto/mxc-scc.c
+++ b/drivers/crypto/mxc-scc.c
@@ -210,18 +210,21 @@ static int mxc_scc_ablkcipher_req_init(struct ablkcipher_request *req,
struct mxc_scc_ctx *ctx)
{
struct mxc_scc *scc = ctx->scc;
+ int nents;
- ctx->src_nents = sg_nents_for_len(req->src, req->nbytes);
- if (ctx->src_nents < 0) {
+ nents = sg_nents_for_len(req->src, req->nbytes);
+ if (nents < 0) {
dev_err(scc->dev, "Invalid number of src SC");
- return ctx->src_nents;
+ return nents;
}
+ ctx->src_nents = nents;
- ctx->dst_nents = sg_nents_for_len(req->dst, req->nbytes);
- if (ctx->dst_nents < 0) {
+ nents = sg_nents_for_len(req->dst, req->nbytes);
+ if (nents < 0) {
dev_err(scc->dev, "Invalid number of dst SC");
- return ctx->dst_nents;
+ return nents;
}
+ ctx->dst_nents = nents;
ctx->size = 0;
ctx->offset = 0;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-25 11:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-22 9:56 [patch 1/2] crypto: mxc-scc - signedness bugs in mxc_scc_ablkcipher_req_init() Dan Carpenter
2016-04-25 11:22 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox