Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4884400pjb; Mon, 27 Jul 2020 07:33:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrl9U52qxZCEwgcUy8YCtgZovosEMUeF6gFPE6jbj6eRfbm12ADoY5pKL0aCxqcFmCzYdn X-Received: by 2002:a17:906:af1a:: with SMTP id lx26mr4907022ejb.415.1595860430969; Mon, 27 Jul 2020 07:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860430; cv=none; d=google.com; s=arc-20160816; b=JFmZGdVxsFoNKTHlPQlWsOwehtwJvUG6lxKjET84yqLj5j/SPHW/n5JCNSTwFZDOfS maqbFjfD5ipuDiYfQ7ImzN0ou9HpogVZYprUISHcnI+hxrc2gQyyLt/lUWHOcqKRe7pV EZRtm5be6jUgDCyLsoC8AyaNAVLnmCCLGn8kbkQ9phIPQsZ0pMSKXQQYybHTBqC0WLDn ltod6Ny631GFNR4FmDmZjaF5T8WxV7XE3gvB4IVLgmZbmx6/nVDObBfAmi0C6d3wdctU 1oNzTe4FfHPCyNzTVnEpdWk7rL+ijTwb9IGDterskMzkUBMFp1tnqXdHg/OZDdZf64hg 4SuA== 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=sgVN54p2su9pO33vsqdwlxTXBKPMEIN8OD3jLkncWD8=; b=ybAU+s/s88sEnd8mZacFt8l0LnMJ4SQMQSib6gLiUEWOAmNSEEoUv6WOKx/eorNN10 UV1KFpLNup7X1buqOjsoUbtw9mRnbO1RzYJCtcsip/57/veHVojNEFghvMzI5kdKMiLv QSoWuezNnF02MFKWmitqV1hqG0a0PTEeTX198IntsGXSI6IXtO8r0UEsmUKVUYm6RjKW 4r0YgywOATEvAl18neu24/+dNI2HaHbK9FTNWsnjmDpQA2bxbVBbScRxt+kZAOZZRSXQ r/3Hs9pPYWkENFWjSZR8nAB0frH2tXF4FNeUOC/tQjJpNGdmHksA9svP8PEEXXq7lRlx 57wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LRlkP8ez; 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 n3si5846762eji.720.2020.07.27.07.33.28; Mon, 27 Jul 2020 07:33:50 -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=LRlkP8ez; 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 S1732289AbgG0OcO (ORCPT + 99 others); Mon, 27 Jul 2020 10:32:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:47432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730149AbgG0OT1 (ORCPT ); Mon, 27 Jul 2020 10:19:27 -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 2D7CE20775; Mon, 27 Jul 2020 14:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859566; bh=Yl21JdGd0aDIm44jfQ3dqKB33jyFSYMfu+vyS93JraU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRlkP8ezZVxrIJ45OgP5b+ezmW64lXxU8QFTkwgcrJOMN/SV6XIDBj4/4rHegOOYF 5AhBpX/TZwCJSmvXYkfm8uRGmPMcKdN7eEM+r6F65XiYYU9imPsdDnJf8uqlIF/KvI 0NfLjNiczfg+KaXLx6vuwwKexDPDQ9Z3ka5UQMf4= 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 5.7 007/179] scsi: scsi_transport_spi: Fix function pointer check Date: Mon, 27 Jul 2020 16:03:02 +0200 Message-Id: <20200727134933.028715007@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@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 f8661062ef954..f3d5b1bbd5aa7 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -339,7 +339,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