Linux-Crypto Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net-next 0/2] Fixing compilation warnings and errors
@ 2020-05-14  7:53 Ayush Sawal
  2020-05-14  7:53 ` [PATCH net-next 1/2] Crypto/chcr: Fixes compilations warnings Ayush Sawal
  2020-05-14  7:53 ` [PATCH net-next 2/2] Crypto/chcr: Fixes a cocci check error Ayush Sawal
  0 siblings, 2 replies; 4+ messages in thread
From: Ayush Sawal @ 2020-05-14  7:53 UTC (permalink / raw)
  To: davem, herbert; +Cc: linux-crypto, netdev, manojmalviya, Ayush Sawal

Patch 1: Fixes the warnings seen when compiling using sparse tool.

Patch 2: Fixes a cocci check error introduced after commit
567be3a5d227 ("crypto: chelsio - Use multiple txq/rxq per
tfm to process the requests").


Ayush Sawal (2):
  Crypto/chcr: Fixes compilations warnings
  Crypto/chcr: Fixes a cocci check error

 drivers/crypto/chelsio/chcr_algo.c  | 9 +++++----
 drivers/crypto/chelsio/chcr_ipsec.c | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

-- 
2.26.0.rc1.11.g30e9940


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] Crypto/chcr: Fixes compilations warnings
  2020-05-14  7:53 [PATCH net-next 0/2] Fixing compilation warnings and errors Ayush Sawal
@ 2020-05-14  7:53 ` Ayush Sawal
  2020-05-14 19:53   ` David Miller
  2020-05-14  7:53 ` [PATCH net-next 2/2] Crypto/chcr: Fixes a cocci check error Ayush Sawal
  1 sibling, 1 reply; 4+ messages in thread
From: Ayush Sawal @ 2020-05-14  7:53 UTC (permalink / raw)
  To: davem, herbert; +Cc: linux-crypto, netdev, manojmalviya, Ayush Sawal

This patch fixes the compilation warnings displayed by sparse tool for
chcr driver.

Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
---
 drivers/crypto/chelsio/chcr_algo.c  | 8 ++++----
 drivers/crypto/chelsio/chcr_ipsec.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index b8c1c4dd3ef0..1aed0e8d6558 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -256,7 +256,7 @@ static void get_aes_decrypt_key(unsigned char *dec_key,
 		return;
 	}
 	for (i = 0; i < nk; i++)
-		w_ring[i] = be32_to_cpu(*(u32 *)&key[4 * i]);
+		w_ring[i] = be32_to_cpu(*(__be32 *)&key[4 * i]);
 
 	i = 0;
 	temp = w_ring[nk - 1];
@@ -275,7 +275,7 @@ static void get_aes_decrypt_key(unsigned char *dec_key,
 	}
 	i--;
 	for (k = 0, j = i % nk; k < nk; k++) {
-		*((u32 *)dec_key + k) = htonl(w_ring[j]);
+		*((__be32 *)dec_key + k) = htonl(w_ring[j]);
 		j--;
 		if (j < 0)
 			j += nk;
@@ -2926,7 +2926,7 @@ static int ccm_format_packet(struct aead_request *req,
 		memcpy(ivptr, req->iv, 16);
 	}
 	if (assoclen)
-		*((unsigned short *)(reqctx->scratch_pad + 16)) =
+		*((__be16 *)(reqctx->scratch_pad + 16)) =
 				htons(assoclen);
 
 	rc = generate_b0(req, ivptr, op_type);
@@ -3201,7 +3201,7 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req,
 	} else {
 		memcpy(ivptr, req->iv, GCM_AES_IV_SIZE);
 	}
-	*((unsigned int *)(ivptr + 12)) = htonl(0x01);
+	*((__be32 *)(ivptr + 12)) = htonl(0x01);
 
 	ulptx = (struct ulptx_sgl *)(ivptr + 16);
 
diff --git a/drivers/crypto/chelsio/chcr_ipsec.c b/drivers/crypto/chelsio/chcr_ipsec.c
index d25689837b26..3a10f51ad6fd 100644
--- a/drivers/crypto/chelsio/chcr_ipsec.c
+++ b/drivers/crypto/chelsio/chcr_ipsec.c
@@ -403,7 +403,7 @@ inline void *copy_esn_pktxt(struct sk_buff *skb,
 	xo = xfrm_offload(skb);
 
 	aadiv->spi = (esphdr->spi);
-	seqlo = htonl(esphdr->seq_no);
+	seqlo = ntohl(esphdr->seq_no);
 	seqno = cpu_to_be64(seqlo + ((u64)xo->seq.hi << 32));
 	memcpy(aadiv->seq_no, &seqno, 8);
 	iv = skb_transport_header(skb) + sizeof(struct ip_esp_hdr);
-- 
2.26.0.rc1.11.g30e9940


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] Crypto/chcr: Fixes a cocci check error
  2020-05-14  7:53 [PATCH net-next 0/2] Fixing compilation warnings and errors Ayush Sawal
  2020-05-14  7:53 ` [PATCH net-next 1/2] Crypto/chcr: Fixes compilations warnings Ayush Sawal
@ 2020-05-14  7:53 ` Ayush Sawal
  1 sibling, 0 replies; 4+ messages in thread
From: Ayush Sawal @ 2020-05-14  7:53 UTC (permalink / raw)
  To: davem, herbert; +Cc: linux-crypto, netdev, manojmalviya, Ayush Sawal

This fixes an error observed after running coccinile
check.
drivers/crypto/chelsio/chcr_algo.c:1462:5-8: Unneeded variable:
"err". Return "0" on line 1480

This line is missed in the commit 567be3a5d227 ("crypto:
chelsio - Use multiple txq/rxq per tfm to process the requests").

Fixes: 567be3a5d227 ("crypto:
chelsio - Use multiple txq/rxq per tfm to process the requests").

Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
---
 drivers/crypto/chelsio/chcr_algo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 1aed0e8d6558..c90b68aebe65 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -1462,6 +1462,7 @@ static int chcr_device_init(struct chcr_context *ctx)
 	int err = 0, rxq_perchan;
 
 	if (!ctx->dev) {
+		err = -ENXIO;
 		u_ctx = assign_chcr_device();
 		if (!u_ctx) {
 			pr_err("chcr device assignment fails\n");
-- 
2.26.0.rc1.11.g30e9940


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 1/2] Crypto/chcr: Fixes compilations warnings
  2020-05-14  7:53 ` [PATCH net-next 1/2] Crypto/chcr: Fixes compilations warnings Ayush Sawal
@ 2020-05-14 19:53   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-05-14 19:53 UTC (permalink / raw)
  To: ayush.sawal; +Cc: herbert, linux-crypto, netdev, manojmalviya

From: Ayush Sawal <ayush.sawal@chelsio.com>
Date: Thu, 14 May 2020 13:23:29 +0530

> @@ -256,7 +256,7 @@ static void get_aes_decrypt_key(unsigned char *dec_key,
>  		return;
>  	}
>  	for (i = 0; i < nk; i++)
> -		w_ring[i] = be32_to_cpu(*(u32 *)&key[4 * i]);
> +		w_ring[i] = be32_to_cpu(*(__be32 *)&key[4 * i]);
>  
>  	i = 0;

If the key stored is a big endian value, please fix the type
of ablkctx->key to be __be32 instead of making the driver so
ugly with unnecessary casts all over the place.

This is a really lazy and sloppy way to fix these warnings, and
I'm not applying stuff like this, sorry.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14  7:53 [PATCH net-next 0/2] Fixing compilation warnings and errors Ayush Sawal
2020-05-14  7:53 ` [PATCH net-next 1/2] Crypto/chcr: Fixes compilations warnings Ayush Sawal
2020-05-14 19:53   ` David Miller
2020-05-14  7:53 ` [PATCH net-next 2/2] Crypto/chcr: Fixes a cocci check error Ayush Sawal

Linux-Crypto Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-crypto/0 linux-crypto/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-crypto linux-crypto/ https://lore.kernel.org/linux-crypto \
		linux-crypto@vger.kernel.org
	public-inbox-index linux-crypto

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-crypto


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git