stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Tom Rix <trix@redhat.com>, James Bottomley <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-scsi@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: [PATCH AUTOSEL 4.9 03/10] scsi: scsi_transport_spi: Fix function pointer check
Date: Tue, 14 Jul 2020 10:40:03 -0400	[thread overview]
Message-ID: <20200714144010.4035987-3-sashal@kernel.org> (raw)
In-Reply-To: <20200714144010.4035987-1-sashal@kernel.org>

From: Tom Rix <trix@redhat.com>

[ Upstream commit 5aee52c44d9170591df65fafa1cd408acc1225ce ]

clang static analysis flags several null function pointer problems.

drivers/scsi/scsi_transport_spi.c:374:1: warning: Called function pointer is null (null dereference) [core.CallAndMessage]
spi_transport_max_attr(offset, "%d\n");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reviewing the store_spi_store_max macro

	if (i->f->set_##field)
		return -EINVAL;

should be

	if (!i->f->set_##field)
		return -EINVAL;

Link: https://lore.kernel.org/r/20200627133242.21618-1-trix@redhat.com
Reviewed-by: James Bottomley <jejb@linux.ibm.com>
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/scsi_transport_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 319868f3f6743..083cd11ce7d7d 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -353,7 +353,7 @@ store_spi_transport_##field(struct device *dev, 			\
 	struct spi_transport_attrs *tp					\
 		= (struct spi_transport_attrs *)&starget->starget_data;	\
 									\
-	if (i->f->set_##field)						\
+	if (!i->f->set_##field)						\
 		return -EINVAL;						\
 	val = simple_strtoul(buf, NULL, 0);				\
 	if (val > tp->max_##field)					\
-- 
2.25.1


  parent reply	other threads:[~2020-07-14 14:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 14:40 [PATCH AUTOSEL 4.9 01/10] pinctrl: amd: fix npins for uart0 in kerncz_groups Sasha Levin
2020-07-14 14:40 ` [PATCH AUTOSEL 4.9 02/10] mac80211: allow rx of mesh eapol frames with default rx key Sasha Levin
2020-07-14 14:40 ` Sasha Levin [this message]
2020-07-14 14:40 ` [PATCH AUTOSEL 4.9 04/10] xtensa: fix __sync_fetch_and_{and,or}_4 declarations Sasha Levin
2020-07-14 14:40 ` [PATCH AUTOSEL 4.9 05/10] xtensa: update *pos in cpuinfo_op.next Sasha Levin
2020-07-14 14:40 ` [PATCH AUTOSEL 4.9 06/10] drivers/net/wan/lapbether: Fixed the value of hard_header_len Sasha Levin
2020-07-14 14:40 ` [PATCH AUTOSEL 4.9 07/10] ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later Sasha Levin
2020-07-14 14:40 ` [PATCH AUTOSEL 4.9 08/10] net: usb: qmi_wwan: add support for Quectel EG95 LTE modem Sasha Levin
2020-07-14 14:40 ` [PATCH AUTOSEL 4.9 09/10] net: sky2: initialize return of gm_phy_read Sasha Levin
2020-07-14 14:40 ` [PATCH AUTOSEL 4.9 10/10] drm/nouveau/i2c/g94-: increase NV_PMGR_DP_AUXCTL_TRANSACTREQ timeout Sasha Levin

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=20200714144010.4035987-3-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@vger.kernel.org \
    --cc=trix@redhat.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).