Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4889148pjb; Mon, 27 Jul 2020 07:40:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxslcKNDDNSpQZXykoBhzMl1DjBvKVonqSIcDFLZuKGFDLIAf1CpAFARFnaGy78AjZsB16F X-Received: by 2002:a17:906:c20f:: with SMTP id d15mr10897189ejz.117.1595860828679; Mon, 27 Jul 2020 07:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860828; cv=none; d=google.com; s=arc-20160816; b=0PHqxtyFGUPdA9a9VhnVG1Wd9/jWTv4IRgG+IBG0mMOuYzxvHRl04Qz0pwcf1MfqRP FD+nzkfheKeS9gGjdYO1RluPMWXDqS+QJr/AEBxKqD+CPzVsuO16/YLyv0Hc0wWKiveK 9bRzu0JcC5B0xrQD/095xMk94tC1a9nFflKijvSPxU9wilfvNDtV1gWFeW6WtEmvpaVi Se/EzzZ7J9IYeW3Asxzz2KeFMPcT0lFvsXexCDjDoGmpj/udiEAqEyj3p0r93qvSNcP6 ekjiShypNC3lfJvhEuDEV1iv2ftMz9Q248da22sGiLmoaclfWhrQH6jqUw24bhjoe1ia tQfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iEYp8REFDg/e77YxeqYFIKnb5L8QqwDqO5oa3+qjG7Q=; b=v4Psr8/qFgnTUDYgfdMpYzJy7OqgePY9p0K8V3AlhZ0TS/4PPRU1d7MPoDvdhlAPF4 jh7wmTwXjPMfT3gi3qG4+AfPEfi+JIVjzXo5/v/09FAGUywq8+6bPfieUrgkGYKJi1jM +Y1tFM1XkSKm1dDQzjH1Mlzy6aA5wyxkURtknvQe8Etf9+fgx5Hc/he5gmMvIdoqTja6 S82mDoe93F3tULHq3A6U2KwZxXO8bbO6cdFwAm5dFxdgsol8MNnz2K0srv+ddupjRbJk bhKaRhWHulpBXcY89R/N3sBABNNDMAbygzJJN08b9HdYL1ERVYs/h8LfqHoUNGZLJnGE hpjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zthnJBfe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ec22si5726874ejb.23.2020.07.27.07.40.06; Mon, 27 Jul 2020 07:40:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zthnJBfe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729803AbgG0OKR (ORCPT + 99 others); Mon, 27 Jul 2020 10:10:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:32822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729790AbgG0OKM (ORCPT ); Mon, 27 Jul 2020 10:10:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B384A2083E; Mon, 27 Jul 2020 14:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859012; bh=hhuOWuHf7e1hRbr1agT3ODhnh3OFAi7Fw/8QD9fmEfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zthnJBfeEiRVB5yEy4i97T6BobtqnCIMI1vtCimZx2gMVspI74JlDUWgc7XLx0Rl8 r6pzcGHFpi4S8L7+Wo72OqzYsbea0RgSanfamZNjnjP3Duq2Bu1Qn+zzvSqNPwhAhE r50hnM8P7WlVp9Cz1dNwpUiL55b+yjdwYMAcSF6A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Bottomley , Tom Rix , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 06/86] scsi: scsi_transport_spi: Fix function pointer check Date: Mon, 27 Jul 2020 16:03:40 +0200 Message-Id: <20200727134914.661970189@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134914.312934924@linuxfoundation.org> References: <20200727134914.312934924@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix [ 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 Signed-off-by: Tom Rix Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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 40b85b752b794..69213842e63e0 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -352,7 +352,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