linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ayush Sawal <ayush.sawal@chelsio.com>
To: davem@davemloft.net, herbert@gondor.apana.org.au
Cc: linux-crypto@vger.kernel.org, netdev@vger.kernel.org,
	manojmalviya@chelsio.com, Ayush Sawal <ayush.sawal@chelsio.com>
Subject: [PATCH net-next 1/2] Crypto/chcr: Fixes compilations warnings
Date: Thu, 14 May 2020 13:23:29 +0530	[thread overview]
Message-ID: <20200514075330.25542-2-ayush.sawal@chelsio.com> (raw)
In-Reply-To: <20200514075330.25542-1-ayush.sawal@chelsio.com>

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


  reply	other threads:[~2020-05-14  7:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14  7:53 [PATCH net-next 0/2] Fixing compilation warnings and errors Ayush Sawal
2020-05-14  7:53 ` Ayush Sawal [this message]
2020-05-14 19:53   ` [PATCH net-next 1/2] Crypto/chcr: Fixes compilations warnings David Miller
2020-05-14  7:53 ` [PATCH net-next 2/2] Crypto/chcr: Fixes a cocci check error Ayush Sawal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200514075330.25542-2-ayush.sawal@chelsio.com \
    --to=ayush.sawal@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=manojmalviya@chelsio.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).