From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CAEAFC433F5 for ; Wed, 4 May 2022 06:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9pvKJtD7MPcA6dLiSDzb1GbW+w/TVRd4RZEriASQWMM=; b=SQAnMrLURPEfmP iItMEqbwsn/g3U+FYvjmrsMIyBiP9wfUk6N1TFWtrru481XmDQm5aT+8clU+ewitaSPW7ffTKvUZX PIhFoxXqoUsyocsMdnQBFumzIBwV2aoNa2zSGH8rNjntz5AP5rFZTQv1kWQWOu7ePsFtrnn9LrE4o zvV1kLQsaB+hk4xfRhgrhmiH4YtFOQy6hMcaLZg1SI2ym1AdZLObfEJSr31Ui+nzhvoa9XjNz3IpK gvnxAz3Gw3KXvvj1O5YGbiV+uklFHMh3738xPx1VF2w5WDCaeP3uroeMVKbZj9Mj4YgHYjDa2I9Je nDQ/hCiJ+0DumN85GnPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nm8vh-0099gS-54; Wed, 04 May 2022 06:56:09 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nm8ve-0099dn-0s for linux-arm-kernel@lists.infradead.org; Wed, 04 May 2022 06:56:07 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2DC1A1042; Tue, 3 May 2022 23:56:03 -0700 (PDT) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 570123FA49; Tue, 3 May 2022 23:56:02 -0700 (PDT) Date: Wed, 4 May 2022 07:55:56 +0100 From: Cristian Marussi To: Dan Carpenter Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, kernel test robot Subject: Re: [PATCH] firmware: arm_scmi: Fix late checks on pointer dereference Message-ID: References: <20220503121047.3590340-1-cristian.marussi@arm.com> <20220504064436.GJ4031@kadam> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220504064436.GJ4031@kadam> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220503_235606_154604_EDFE212F X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, May 04, 2022 at 09:44:36AM +0300, Dan Carpenter wrote: > On Tue, May 03, 2022 at 01:10:47PM +0100, Cristian Marussi wrote: > > A few dereferences could happen before the iterator pointer argument was > > checked for NULL, causing the following smatch warnings: > > > > drivers/firmware/arm_scmi/driver.c:1214 scmi_iterator_run() warn: variable > > dereferenced before check 'i' (see line 1210) > > > > Fix by moving the checks early and dropping some unneeded local references. > > > > No functional change. > Hi Dan, thanks for you feedback first of all. > If there is no chance these can be NULL then a different option is to > just delete the NULL checks. Indeed, I think I kept only the checks on iter param that can possibly be NULL if the caller messes up the usage of this iterator interface (or if the internals are messed up by future developments...just to play on the safe side). Thanks, Cristian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel