DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Harman Kalra <hkalra@marvell.com>
Subject: [PATCH 01/16] common/cnxk: remove duplicate condition
Date: Thu, 14 Nov 2024 22:05:38 -0800	[thread overview]
Message-ID: <20241115060738.313190-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20241115060738.313190-1-stephen@networkplumber.org>

The same condition is checked twice in an if statement.
Harmless, but redundant.

Link: https://pvs-studio.com/en/blog/posts/cpp/1183/

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/common/cnxk/cnxk_security.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c
index c2871ad2bd..9446c14ac8 100644
--- a/drivers/common/cnxk/cnxk_security.c
+++ b/drivers/common/cnxk/cnxk_security.c
@@ -174,9 +174,11 @@ ot_ipsec_sa_common_param_fill(union roc_ot_ipsec_sa_word2 *w2, uint8_t *cipher_k
 	}
 
 	/* Set AES key length */
-	if (w2->s.enc_type == ROC_IE_SA_ENC_AES_CBC || w2->s.enc_type == ROC_IE_SA_ENC_AES_CCM ||
-	    w2->s.enc_type == ROC_IE_SA_ENC_AES_CTR || w2->s.enc_type == ROC_IE_SA_ENC_AES_GCM ||
-	    w2->s.enc_type == ROC_IE_SA_ENC_AES_CCM || w2->s.auth_type == ROC_IE_SA_AUTH_AES_GMAC) {
+	if (w2->s.enc_type == ROC_IE_SA_ENC_AES_CBC ||
+	    w2->s.enc_type == ROC_IE_SA_ENC_AES_CTR ||
+	    w2->s.enc_type == ROC_IE_SA_ENC_AES_GCM ||
+	    w2->s.enc_type == ROC_IE_SA_ENC_AES_CCM ||
+	    w2->s.auth_type == ROC_IE_SA_AUTH_AES_GMAC) {
 		switch (length) {
 		case ROC_CPT_AES128_KEY_LEN:
 			w2->s.aes_key_len = ROC_IE_SA_AES_KEY_LEN_128;
@@ -879,9 +881,11 @@ on_ipsec_sa_ctl_set(struct rte_security_ipsec_xform *ipsec,
 	}
 
 	/* Set AES key length */
-	if (ctl->enc_type == ROC_IE_SA_ENC_AES_CBC || ctl->enc_type == ROC_IE_SA_ENC_AES_CCM ||
-	    ctl->enc_type == ROC_IE_SA_ENC_AES_CTR || ctl->enc_type == ROC_IE_SA_ENC_AES_GCM ||
-	    ctl->enc_type == ROC_IE_SA_ENC_AES_CCM || ctl->auth_type == ROC_IE_SA_AUTH_AES_GMAC) {
+	if (ctl->enc_type == ROC_IE_SA_ENC_AES_CBC ||
+	    ctl->enc_type == ROC_IE_SA_ENC_AES_CTR ||
+	    ctl->enc_type == ROC_IE_SA_ENC_AES_GCM ||
+	    ctl->enc_type == ROC_IE_SA_ENC_AES_CCM ||
+	    ctl->auth_type == ROC_IE_SA_AUTH_AES_GMAC) {
 		switch (aes_key_len) {
 		case 16:
 			ctl->aes_key_len = ROC_IE_SA_AES_KEY_LEN_128;
-- 
2.45.2


  reply	other threads:[~2024-11-15  6:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15  6:05 [PATCH 00/16] small bug fixes from PVS studio bug list Stephen Hemminger
2024-11-15  6:05 ` Stephen Hemminger [this message]
2024-11-15  6:16   ` [EXTERNAL] [PATCH 01/16] common/cnxk: remove duplicate condition Anoob Joseph
2024-11-15  6:05 ` [PATCH 02/16] net/cpfl: avoid calling log (printf) with null Stephen Hemminger
2024-11-15  6:05 ` [PATCH 03/16] raw/cnxk_gpio: fix file descriptor leak Stephen Hemminger
2024-11-15  6:05 ` [PATCH 04/16] net/ntnic: remove dead code Stephen Hemminger
2024-11-15  6:05 ` [PATCH 05/16] net/i40e: remove duplicate code Stephen Hemminger
2024-11-15  6:05 ` [PATCH 06/16] eal: fix out of bounds access in devargs Stephen Hemminger
2024-11-15  6:05 ` [PATCH 07/16] net/qede: fix missing debug string Stephen Hemminger
2024-11-15  6:05 ` [PATCH 08/16] examples/ptpclient: replace rte_memcpy with assignment Stephen Hemminger
2024-11-15  6:05 ` [PATCH 09/16] examples/ptpclient: fix self memcmp Stephen Hemminger
2024-11-15  6:05 ` [PATCH 10/16] net/octeon_ep: remove duplicate code Stephen Hemminger
2024-11-15  6:05 ` [PATCH 11/16] net/hinic: fix flow type bitmask overflow Stephen Hemminger
2024-11-15  6:05 ` [PATCH 12/16] crypto/dpaa2_sec: fix bitmask truncation Stephen Hemminger
2024-11-15  6:05 ` [PATCH 13/16] crypto/dpaa_sec: " Stephen Hemminger
2024-11-15  6:05 ` [PATCH 14/16] event/dpaa: " Stephen Hemminger
2024-11-15  6:05 ` [PATCH 15/16] net/dpaa: " Stephen Hemminger
2024-11-15  6:05 ` [PATCH 16/16] net/dpaa2: " Stephen Hemminger

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=20241115060738.313190-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    /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).