All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
To: linux-scsi@vger.kernel.org
Cc: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
Subject: [PATCH 2/2] scsi: fnic: drop unnecessary NULL check in is_fnic_fip_flogi_reject()
Date: Tue, 28 Nov 2023 17:13:52 +0000	[thread overview]
Message-ID: <20231128171352.221822-2-aleksei.kodanev@bell-sw.com> (raw)
In-Reply-To: <20231128171352.221822-1-aleksei.kodanev@bell-sw.com>

    if (desc->fip_dtype == FIP_DT_FLOGI) {
        ...
        els = (struct fip_encaps *)desc;
        fh = (struct fc_frame_header *)(els + 1);

'fh' cannot be NULL here after shifting a valid pointer 'desc'.

Detected using the static analysis tool - Svace.

Fixes: d3c995f1dcf9 ("[SCSI] fnic: FIP VLAN Discovery Feature Support")
Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 drivers/scsi/fnic/fnic_fcs.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
index 55632c67a8f2..ca4214db72f5 100644
--- a/drivers/scsi/fnic/fnic_fcs.c
+++ b/drivers/scsi/fnic/fnic_fcs.c
@@ -338,9 +338,6 @@ static inline int is_fnic_fip_flogi_reject(struct fcoe_ctlr *fip,
 		els = (struct fip_encaps *)desc;
 		fh = (struct fc_frame_header *)(els + 1);
 
-		if (!fh)
-			return 0;
-
 		/*
 		 * ELS command code, reason and explanation should be = Reject,
 		 * unsupported command and insufficient resource
-- 
2.25.1


      reply	other threads:[~2023-11-28 17:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 17:13 [PATCH 1/2] scsi: message: fusion: fix array index check in mpt_sas_log_info() Alexey Kodanev
2023-11-28 17:13 ` Alexey Kodanev [this message]

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=20231128171352.221822-2-aleksei.kodanev@bell-sw.com \
    --to=aleksei.kodanev@bell-sw.com \
    --cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.