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=-6.8 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 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 94C56C48BE3 for ; Thu, 20 Jun 2019 21:39:26 +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 6C88720657 for ; Thu, 20 Jun 2019 21:39:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fGEC3tZZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wmw20NOU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C88720657 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e+0xdzScns5NaN6PNKeEr+AWwkM9muoePaL34hbpm3k=; b=fGEC3tZZfPr3Kh 0dyllFfpq6b/cd8Wp7/hUmeCExXNsILahYGZLAXF6lM+HH8/zp0L1/MTEC+BfIO5jP0evNed0zVQ/ qWa/380ZsLzuv4w83XMlpDf+6NZj7iMEPE6GVYJHmP+KMVyYkR6mGidZU+sl/h6oUGA9a3egBTalB kS9mcnHzT1/dSUq7H76tb4QIfrHd1AScHwz0dytS2P2M2eA8fT93PAQ/KXPHnQ58KsVHyQ/VQ6Fuk 44BOHpCPfsTxT9C66FTEzR3rfCJCFh2mCGY1IZFxI78C/hvYn7Hf1wR4sM7LBBH9ZwcrcEjLpfTb1 eGpiogNGCs2RVGUZCX9Q==; 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 1he4mD-0003Qk-Sp; Thu, 20 Jun 2019 21:39:25 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1he4ly-0003Ex-Rr for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 21:39:15 +0000 Received: by mail-io1-xd41.google.com with SMTP id k8so487948iot.1 for ; Thu, 20 Jun 2019 14:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eTRUUPmiMamYKCB7Iqq3svN/bcQUQ7UKOx9BoMFQ/BI=; b=wmw20NOUs4dukGCTnFfaW9eZPX10WLGF6jWY5I+nZ8UVJSEsugt3NpVYe1lfSwN5AC 73x9KQIl9xF9nS2ITvXoHHAz33kvccTg0Nfqb3fJ9Ghjzs+66pH8+TzF8gsTesua6JHu NIO3JQmOe3Z5g2zGf1qxCDVpEASp+7Ki4RQlFFoipZGZvMiutSdffHbBp5d6XP2ro2zq VfcaVER4yWS8mwAjClFxCHtarhg0MNhcD2SPTYBP2wpvRY15NP9wa4QF9d3JVZ2eKkf8 wo5OSwgN8vxT2cK7ayrNoE4FRBga+7Z3LfVuUjxbAbxaSYGiNW6+TQSAw0ykrFUNU76B QXOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eTRUUPmiMamYKCB7Iqq3svN/bcQUQ7UKOx9BoMFQ/BI=; b=jLdDeMF0wLnSnurWTPIFv1s2oBaemq0gAZxyTE0lyH6/nufKW9exqj+Ji5OiMIE11F Owb/3cbqWzq5XEvgQnQHYCSTtua449MiGRxaCNugZcPmEPfi5WxY5cyv7sq4kPNLHhLG XFYP/QTDid7o++lOJskmEw4ikF9Et7jAI/06EN2UcAkdnHixiqyk6vA6JT33YQinGkRK 7L7i5aXiMcIVfWep+sVv3uRLqmiiPZ1uxJmDV2vRKoEb6Rb10H8rbebqq3q4QPmPSS/s zLxXDtfFdTvQyDi/IvomaEiRjnvdSpV1xF05BVHzbMzuYYfNpae/pOD2IiC+i45w4yfs 5yeg== X-Gm-Message-State: APjAAAUYLBpZP8kQsHpP+IIufJEpgxHM1OuTuZPfH0/LnqIkVVm0lGWe 1qkexNbkhRnx5fICrzGdgLLt5O+jy182RtmdSmoxEQ== X-Google-Smtp-Source: APXvYqzj0H/p7uf2R4X1y+LiGl7Vb1u3TaIPnTnUXDYOktMfCEIEqBo80owudjp304zkvqzFxjPoH8s2uuJW3AEFf0M= X-Received: by 2002:a5d:9dc7:: with SMTP id 7mr21801931ioo.237.1561066749368; Thu, 20 Jun 2019 14:39:09 -0700 (PDT) MIME-Version: 1.0 References: <20190619195318.19254-1-mathieu.poirier@linaro.org> <20190619195318.19254-26-mathieu.poirier@linaro.org> <20190620060459.GF26319@kroah.com> In-Reply-To: <20190620060459.GF26319@kroah.com> From: Mathieu Poirier Date: Thu, 20 Jun 2019 15:38:58 -0600 Message-ID: Subject: Re: [PATCH 25/28] coresight: etm3x: Smatch: Fix potential NULL pointer dereference To: Greg KH X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_143910_935793_F4AB6C50 X-CRM114-Status: GOOD ( 19.58 ) 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, 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel