From patchwork Wed Oct 28 17:43:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 11862949 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=-12.8 required=3.0 tests=BAYES_00,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_GIT 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 D8919C55178 for ; Wed, 28 Oct 2020 17:44:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 5DE19247E4 for ; Wed, 28 Oct 2020 17:44:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EXik6sf8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zxa2ZHOR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DE19247E4 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+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=yripCFTiC3phMstZCHiLGTgn/SdWnBGscJHndndZerQ=; b=EXik6sf8fG9uNIkcRGWaXqFV19 /4FfHFYYqRZp20pTOjietBwPrwkaPHZ3EEXUpaqC2+NYQLl5AWeUzOcwsWpjHz1uwZGBI3edxZxfh yd37Vqds7gWJssMGG2wYBGNhpm4N/x9gN3r7v92PnrU6rs3rx6KlejInFfix4Uz8WdLh48hMmwMIQ wp+DZqCQ1uPvY4BOIwMv00nhZhIJ34O/lQ6ESZoJOyKeguaAdNT3nXb4wFstyJN1oBrOkvXS++PdR iwQI6l0NAJqmzjcNHtRg3Vi4468Xt/gJjkzIejmVq3fKmbRsMySqFbgRds+Law8Ew0fkja54AJlQv IJfMpD4w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXpTb-0006tl-4S; Wed, 28 Oct 2020 17:43:11 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXpTX-0006t2-Kg for linux-arm-kernel@lists.infradead.org; Wed, 28 Oct 2020 17:43:08 +0000 Received: by mail-wm1-x343.google.com with SMTP id d3so96039wma.4 for ; Wed, 28 Oct 2020 10:43:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=qzgYKCsiMnXsmskR2AeWiZoW4TSnZRw9RpEp8cpRUVw=; b=zxa2ZHORY/A1Hr3hXOTaXqDjjIcP/pSLHPanPTJq+q08uv+4c7dgB5z5XrtECu4TQH egJMTGCQpVLL/2QX/6D5LL7cH/1v6elTs5fiOkKOWqWqaFgEvxB/xaSkkTXmpS61TieF r/zyhYeIEmYCZaUJPsGj7p2w7+c/lPcj1esiLkyrV6pWuYfzGIP4dt73r14bT2/NiATM +1eJ/Ho4IKlSCSAQ3EjGhc4OrYh0vMEv1PG7O6nrmydP15LWHLEYPRR5WcPnpzT/jdAo OGmda/NjACcen/ScNKdvYz8Y8DigfN3LzSZ6evYtbeCTmzVPy5TmkpQLxrYKI7jbOrbJ kZ+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qzgYKCsiMnXsmskR2AeWiZoW4TSnZRw9RpEp8cpRUVw=; b=T4MY/rtujLF3ogeGf6kQxvlpEs7pYR1kDIHgv2pUXRuU/rBrF6bEDkFt30+GZxPYZF WkSYohKSAoekRz/G9z6AzsjxR0yQE+iH5nXybZwUmiayHcQ0Bh18DeZxmoe2Em2hJ3wH zcRvikrAwWKi3CfIe86cG9j1tleH6wQNw3APMcenbvGPnB3mJKkRBFDJfWwyd9PcXcKo Hf/SFCTNgU4Ox4HRiYsaE9T50iJSHCIHucLuuUTaClrk8jJBghsJseUZn6S5MEsX5h9c 6A9hhaLuu5U9Ykmw1s0huaCerGxyxwIOFFLbTWc3FNrXYKES9CuYLbeM8u+GE/76whi0 COoA== X-Gm-Message-State: AOAM530K3YMJxJp/yfeqqr5KiiiUvgmu/Bcl0fr3UOo3qgmF1j0tvFUZ WtAe3gw3CRl+Zm271EzotTy/sFhZcszhBw== X-Google-Smtp-Source: ABdhPJyJ7qJQ1CG2LCPBx9KM44hsM8+B9d4qehnbpLRnkp+zVDEweTVPGs84koksBhyMdRzWQnlwWQ== X-Received: by 2002:a7b:c453:: with SMTP id l19mr618021wmi.50.1603906984838; Wed, 28 Oct 2020 10:43:04 -0700 (PDT) Received: from linaro.org ([2a00:23c5:6801:1801:1071:bc1a:781b:f835]) by smtp.gmail.com with ESMTPSA id o4sm405104wrv.8.2020.10.28.10.43.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 10:43:04 -0700 (PDT) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH] coresight: Fix uninitialised pointer bug in etm_setup_aux() Date: Wed, 28 Oct 2020 17:43:01 +0000 Message-Id: <20201028174301.15033-1-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201028_134307_780272_3F9A254B X-CRM114-Status: GOOD ( 15.92 ) 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: alexander.shishkin@linux.intel.com, Mike Leach , lcherian@marvell.com, suzuki.poulose@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit [bb1860efc817] changed the sink handling code introducing an uninitialised pointer bug. This results in the default sink selection failing. Prior to commit: static void etm_setup_aux(...) struct coresight_device *sink; /* First get the selected sink from user space. */ if (event->attr.config2) { id = (u32)event->attr.config2; sink = coresight_get_sink_by_id(id); } else { sink = coresight_get_enabled_sink(true); } *sink always initialised - possibly to NULL which triggers the automatic sink selection. After commit: static void etm_setup_aux(...) struct coresight_device *sink; /* First get the selected sink from user space. */ if (event->attr.config2) { id = (u32)event->attr.config2; sink = coresight_get_sink_by_id(id); } *sink pointer uninitialised when not providing a sink on the perf command line. This breaks later checks to enable automatic sink selection. Fixes [bb1860efc817] ("coresight: etm: perf: Sink selection using sysfs is deprecated") Signed-off-by: Mike Leach --- drivers/hwtracing/coresight/coresight-etm-perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index c2c9b127d074..bdc34ca449f7 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -210,7 +210,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, u32 id; int cpu = event->cpu; cpumask_t *mask; - struct coresight_device *sink; + struct coresight_device *sink = NULL; struct etm_event_data *event_data = NULL; event_data = alloc_event_data(cpu);