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 7E2FDC43613 for ; Fri, 21 Jun 2019 06:59:36 +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 4E7DF2083B for ; Fri, 21 Jun 2019 06:59:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C52xXz54"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="CknQ5e/y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E7DF2083B 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=s9tdxxQ71kphLqIqAJtGLU0K4Z+i0HkdcZ3SvagFmG4=; b=C52xXz54Hzi9qF 623XOBA217pqQmQ+Byr7sEN37tFYRWPRe61ChHtGd/8E66yzU1SoHKCMlRAROVvR79fuq5xWsh7dw taVKS8b+McJ3AlbfWdu/2sBG27YkT4K2Q/qx3PMslZB8+piH84baLzT9ysrT+sCECOtThJBoKuCWe c2xOmME1t/9Yu9ChSQK0nH0QsZDOAfhb0BQKVrag/XT3cc8NAs0ZwJn1NW3FoiH1TmekEi/xSh6D2 MVpiaiO+4s9+UAL6EyBl2IUmdA2c1p3GhQQ5wBCcGShqtK3WuaqjZW8tTkttPo4CCcZ87QtqR6Rdk jls8uoVnr7bSLarAnroA==; 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 1heDWC-0004zp-Eh; Fri, 21 Jun 2019 06:59:28 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1heDVt-0004uS-Ja for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2019 06:59:12 +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 B3BCC2083B; Fri, 21 Jun 2019 06:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561100349; bh=YEnGoGOBzicm6dBkYahmJBbJLno/8v/b5ZJF7ct43+M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CknQ5e/y8e0Lvth76r+MMpyYIS5D4csS3802N223ALcnLHL0cPLmmQKrGmqa9pZop +iDp1OTj4HLtx2c28c6W3bKvklI49V1IbZitGq7EKNitlY3XpjXdJd6g0lPEj8qS4l HGogMEkgC+hIWBpnnG8QCamZESEdoA9uYJyzwcf0= Date: Fri, 21 Jun 2019 08:59:06 +0200 From: Greg KH To: Mathieu Poirier Subject: Re: [PATCH 25/28] coresight: etm3x: Smatch: Fix potential NULL pointer dereference Message-ID: <20190621065906.GA14945@kroah.com> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> <20190619195318.19254-26-mathieu.poirier@linaro.org> <20190620060459.GF26319@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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-20190620_235910_874473_D73FF9D1 X-CRM114-Status: GOOD ( 21.44 ) 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 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 Thu, Jun 20, 2019 at 03:38:58PM -0600, Mathieu Poirier wrote: > On Thu, 20 Jun 2019 at 00:05, Greg KH wrote: > > > > 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? > > This patch is fixing code that was introduced by patch 12/45 [1] of > the original set - it should really be applied on top you > char-misc-next for the 5.3 merge window. > > [1]. https://www.spinics.net/lists/arm-kernel/msg736150.html Ok, can you resend it then? thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel