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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5841DC43613 for ; Thu, 20 Jun 2019 06:05:07 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2340C20B1F for ; Thu, 20 Jun 2019 06:05:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cUsgS3w6"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="HdaqC/eZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2340C20B1F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject: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=Q7RrxrqgmFdT4fkeYHecuGc2Vm3NAz9VArPQSTt+ynM=; b=cUsgS3w6xaWhSA 5ad9Fz2owea+4edIdBifA8R/suAQ+aczDm50zoJNlRR1Em6eiGpddy2h3z6buIRmLlRSoIg+5MEXe UNttxnyv+FJR+F5V8mWfTsVLtfKIdAzGbPA4zPMfjix4w/JhTpfeGn1CWvPU3zG4xLn1hhlhbqtO0 CgaWwl3hwhW3J+lz1+HJqwDChLglj46Xmgw2mK51rJh5dvImpBchRDzThDNUUXc9btk2j6ROEPa3X iKSHIR7iXOl6ofAOn3dJm/m1y4A8rNAS40sREiVt67rD9y/DG8cyBt96hVHfUExyeL3jtSwLbFtIQ Xq1LPZK7qLmSS67RCrJg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdqC2-0001ro-GP; Thu, 20 Jun 2019 06:05:06 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdqBy-0001QM-BN for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 06:05:03 +0000 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 8E3AB20B1F; Thu, 20 Jun 2019 06:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561010702; bh=JxSBMAnuVjwaDaLG39Kh0Z+is/lXGybcgQprRrj5mk4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HdaqC/eZukFxGK735GcvEtjnNS+ktAAR5MrFATmBXzjr7fK0C2Ym1FCqq8DoG6NK/ Zq3UZ1N0DHVSOj9a48kBQ53Kf0KRhEmdp0NpozPIPN6oeqm1d9I9WpVaQR59XbpOlh tn6ktBRS8ISuW1w8mVFI03RjIE2ypgFtyTsZTAA8= Date: Thu, 20 Jun 2019 08:04:59 +0200 From: Greg KH To: Mathieu Poirier Subject: Re: [PATCH 25/28] coresight: etm3x: Smatch: Fix potential NULL pointer dereference Message-ID: <20190620060459.GF26319@kroah.com> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> <20190619195318.19254-26-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190619195318.19254-26-mathieu.poirier@linaro.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_230502_426229_EFDE8B92 X-CRM114-Status: GOOD ( 16.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 19, 2019 at 01:53:15PM -0600, Mathieu Poirier wrote: > From: Suzuki K Poulose > > Based on the following report from Smatch tool, make sure we have a > valid drvdata before we dereference it to find the real dev. > > The patch 21d26b905c05: "coresight: etm: Clean up device specific > data" from May 22, 2019, leads to the following Smatch complaint: > > ./drivers/hwtracing/coresight/coresight-etm3x.c:460 etm_get_trace_id() > warn: variable dereferenced before check 'drvdata' (see line 458) > > ./drivers/hwtracing/coresight/coresight-etm3x.c > 457 int trace_id = -1; > 458 struct device *etm_dev = drvdata->csdev->dev.parent; > ^^^^^^^^^ > New dereference > > 459 > 460 if (!drvdata) > ^^^^^^^^ > Checked too late. Delete the check? > > 461 goto out; > 462 > > Cc: Mathieu Poirier > Cc: Dan Carpenter > Signed-off-by: Suzuki K Poulose > Signed-off-by: Mathieu Poirier > --- > drivers/hwtracing/coresight/coresight-etm3x.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c > index bed729140718..225c2982e4fe 100644 > --- a/drivers/hwtracing/coresight/coresight-etm3x.c > +++ b/drivers/hwtracing/coresight/coresight-etm3x.c > @@ -455,11 +455,12 @@ int etm_get_trace_id(struct etm_drvdata *drvdata) > { > unsigned long flags; > int trace_id = -1; > - struct device *etm_dev = drvdata->csdev->dev.parent; > + struct device *etm_dev; > > if (!drvdata) > goto out; > > + etm_dev = drvdata->csdev->dev.parent; > if (!local_read(&drvdata->mode)) > return drvdata->traceid; > > -- > 2.17.1 > Looks like 5.2 and possibly stable material, right? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel