提交 5f5354b9 编写于 作者: H Herbert Xu 提交者: Yang Yingliang

crypto: sun4i-ss - Fix 64-bit size_t warnings

[ Upstream commit d6e9da21ee8246b5e556b3b153401ab045adb986 ]

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.
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Acked-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
Tested-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 c58270a7
...@@ -81,7 +81,8 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq) ...@@ -81,7 +81,8 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq)
oi = 0; oi = 0;
oo = 0; oo = 0;
do { do {
todo = min3(rx_cnt, ileft, (mi.length - oi) / 4); todo = min(rx_cnt, ileft);
todo = min_t(size_t, todo, (mi.length - oi) / 4);
if (todo) { if (todo) {
ileft -= todo; ileft -= todo;
writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo); writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo);
...@@ -96,7 +97,8 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq) ...@@ -96,7 +97,8 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq)
rx_cnt = SS_RXFIFO_SPACES(spaces); rx_cnt = SS_RXFIFO_SPACES(spaces);
tx_cnt = SS_TXFIFO_SPACES(spaces); tx_cnt = SS_TXFIFO_SPACES(spaces);
todo = min3(tx_cnt, oleft, (mo.length - oo) / 4); todo = min(tx_cnt, oleft);
todo = min_t(size_t, todo, (mo.length - oo) / 4);
if (todo) { if (todo) {
oleft -= todo; oleft -= todo;
readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo); readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo);
...@@ -220,7 +222,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) ...@@ -220,7 +222,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
* todo is the number of consecutive 4byte word that we * todo is the number of consecutive 4byte word that we
* can read from current SG * can read from current SG
*/ */
todo = min3(rx_cnt, ileft / 4, (mi.length - oi) / 4); todo = min(rx_cnt, ileft / 4);
todo = min_t(size_t, todo, (mi.length - oi) / 4);
if (todo && !ob) { if (todo && !ob) {
writesl(ss->base + SS_RXFIFO, mi.addr + oi, writesl(ss->base + SS_RXFIFO, mi.addr + oi,
todo); todo);
...@@ -234,8 +237,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) ...@@ -234,8 +237,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
* we need to be able to write all buf in one * we need to be able to write all buf in one
* pass, so it is why we min() with rx_cnt * pass, so it is why we min() with rx_cnt
*/ */
todo = min3(rx_cnt * 4 - ob, ileft, todo = min(rx_cnt * 4 - ob, ileft);
mi.length - oi); todo = min_t(size_t, todo, mi.length - oi);
memcpy(buf + ob, mi.addr + oi, todo); memcpy(buf + ob, mi.addr + oi, todo);
ileft -= todo; ileft -= todo;
oi += todo; oi += todo;
...@@ -255,7 +258,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) ...@@ -255,7 +258,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
spaces = readl(ss->base + SS_FCSR); spaces = readl(ss->base + SS_FCSR);
rx_cnt = SS_RXFIFO_SPACES(spaces); rx_cnt = SS_RXFIFO_SPACES(spaces);
tx_cnt = SS_TXFIFO_SPACES(spaces); tx_cnt = SS_TXFIFO_SPACES(spaces);
dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n", dev_dbg(ss->dev,
"%x %u/%zu %u/%u cnt=%u %u/%zu %u/%u cnt=%u %u\n",
mode, mode,
oi, mi.length, ileft, areq->cryptlen, rx_cnt, oi, mi.length, ileft, areq->cryptlen, rx_cnt,
oo, mo.length, oleft, areq->cryptlen, tx_cnt, ob); oo, mo.length, oleft, areq->cryptlen, tx_cnt, ob);
...@@ -263,7 +267,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) ...@@ -263,7 +267,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
if (!tx_cnt) if (!tx_cnt)
continue; continue;
/* todo in 4bytes word */ /* todo in 4bytes word */
todo = min3(tx_cnt, oleft / 4, (mo.length - oo) / 4); todo = min(tx_cnt, oleft / 4);
todo = min_t(size_t, todo, (mo.length - oo) / 4);
if (todo) { if (todo) {
readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo); readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo);
oleft -= todo * 4; oleft -= todo * 4;
...@@ -287,7 +292,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) ...@@ -287,7 +292,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)
* no more than remaining buffer * no more than remaining buffer
* no need to test against oleft * no need to test against oleft
*/ */
todo = min(mo.length - oo, obl - obo); todo = min_t(size_t,
mo.length - oo, obl - obo);
memcpy(mo.addr + oo, bufo + obo, todo); memcpy(mo.addr + oo, bufo + obo, todo);
oleft -= todo; oleft -= todo;
obo += todo; obo += todo;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册