Skip to content

Commit

Permalink
crypto: talitos - Endianess in current_desc_hdr()
Browse files Browse the repository at this point in the history
[ Upstream commit 195404d ]

current_desc_hdr() compares the value of the current descriptor
with the next_desc member of the talitos_desc struct.

While the current descriptor is obtained from in_be32() which
return CPU ordered bytes, next_desc member is in big endian order.

Convert the current descriptor into big endian before comparing it
with next_desc.

This fixes a sparse warning.

Fixes: 37b5e88 ("crypto: talitos - chain in buffered data for ahash on SEC1")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
chleroy authored and gregkh committed Dec 30, 2020
1 parent 3267132 commit 7023c81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/crypto/talitos.c
Expand Up @@ -478,15 +478,15 @@ static u32 current_desc_hdr(struct device *dev, int ch)

iter = tail;
while (priv->chan[ch].fifo[iter].dma_desc != cur_desc &&
priv->chan[ch].fifo[iter].desc->next_desc != cur_desc) {
priv->chan[ch].fifo[iter].desc->next_desc != cpu_to_be32(cur_desc)) {
iter = (iter + 1) & (priv->fifo_len - 1);
if (iter == tail) {
dev_err(dev, "couldn't locate current descriptor\n");
return 0;
}
}

if (priv->chan[ch].fifo[iter].desc->next_desc == cur_desc) {
if (priv->chan[ch].fifo[iter].desc->next_desc == cpu_to_be32(cur_desc)) {
struct talitos_edesc *edesc;

edesc = container_of(priv->chan[ch].fifo[iter].desc,
Expand Down

0 comments on commit 7023c81

Please sign in to comment.