diff options
author | Corentin Labbe | 2019-11-14 04:49:06 -0600 |
---|---|---|
committer | Greg Kroah-Hartman | 2019-12-31 05:37:48 -0600 |
commit | cb40551504fd78fccbb32efa3c51ce043f9b7d8d (patch) | |
tree | 4040e64eb9631d8516a2d1cee2d7385ccd81c196 | |
parent | 08f433fca0056563812a8d5ff436d9a629e2029f (diff) | |
download | kernel-cb40551504fd78fccbb32efa3c51ce043f9b7d8d.tar.gz kernel-cb40551504fd78fccbb32efa3c51ce043f9b7d8d.tar.xz kernel-cb40551504fd78fccbb32efa3c51ce043f9b7d8d.zip |
crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c
[ Upstream commit a7126603d46fe8f01aeedf589e071c6aaa6c6c39 ]
If you try to compile this driver on a 64-bit platform then you
will get warnings because it mixes size_t with unsigned int which
only works on 32-bit.
This patch fixes all of the warnings on sun4i-ss-hash.c.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c index f6936bb3b7be..1a724263761b 100644 --- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c +++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c | |||
@@ -276,8 +276,8 @@ static int sun4i_hash(struct ahash_request *areq) | |||
276 | */ | 276 | */ |
277 | while (op->len < 64 && i < end) { | 277 | while (op->len < 64 && i < end) { |
278 | /* how many bytes we can read from current SG */ | 278 | /* how many bytes we can read from current SG */ |
279 | in_r = min3(mi.length - in_i, end - i, | 279 | in_r = min(end - i, 64 - op->len); |
280 | 64 - op->len); | 280 | in_r = min_t(size_t, mi.length - in_i, in_r); |
281 | memcpy(op->buf + op->len, mi.addr + in_i, in_r); | 281 | memcpy(op->buf + op->len, mi.addr + in_i, in_r); |
282 | op->len += in_r; | 282 | op->len += in_r; |
283 | i += in_r; | 283 | i += in_r; |
@@ -297,8 +297,8 @@ static int sun4i_hash(struct ahash_request *areq) | |||
297 | } | 297 | } |
298 | if (mi.length - in_i > 3 && i < end) { | 298 | if (mi.length - in_i > 3 && i < end) { |
299 | /* how many bytes we can read from current SG */ | 299 | /* how many bytes we can read from current SG */ |
300 | in_r = min3(mi.length - in_i, areq->nbytes - i, | 300 | in_r = min_t(size_t, mi.length - in_i, areq->nbytes - i); |
301 | ((mi.length - in_i) / 4) * 4); | 301 | in_r = min_t(size_t, ((mi.length - in_i) / 4) * 4, in_r); |
302 | /* how many bytes we can write in the device*/ | 302 | /* how many bytes we can write in the device*/ |
303 | todo = min3((u32)(end - i) / 4, rx_cnt, (u32)in_r / 4); | 303 | todo = min3((u32)(end - i) / 4, rx_cnt, (u32)in_r / 4); |
304 | writesl(ss->base + SS_RXFIFO, mi.addr + in_i, todo); | 304 | writesl(ss->base + SS_RXFIFO, mi.addr + in_i, todo); |
@@ -324,8 +324,8 @@ static int sun4i_hash(struct ahash_request *areq) | |||
324 | if ((areq->nbytes - i) < 64) { | 324 | if ((areq->nbytes - i) < 64) { |
325 | while (i < areq->nbytes && in_i < mi.length && op->len < 64) { | 325 | while (i < areq->nbytes && in_i < mi.length && op->len < 64) { |
326 | /* how many bytes we can read from current SG */ | 326 | /* how many bytes we can read from current SG */ |
327 | in_r = min3(mi.length - in_i, areq->nbytes - i, | 327 | in_r = min(areq->nbytes - i, 64 - op->len); |
328 | 64 - op->len); | 328 | in_r = min_t(size_t, mi.length - in_i, in_r); |
329 | memcpy(op->buf + op->len, mi.addr + in_i, in_r); | 329 | memcpy(op->buf + op->len, mi.addr + in_i, in_r); |
330 | op->len += in_r; | 330 | op->len += in_r; |
331 | i += in_r; | 331 | i += in_r; |