Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp52980pxx; Wed, 28 Oct 2020 17:56:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypiCjqfIT0ga5ett2aXRphq0/JKYhLwhHuKuSWmoYo24Z/cSXkXaTXRkwnjA61zMSh0+Kz X-Received: by 2002:a17:906:edc8:: with SMTP id sb8mr1640786ejb.241.1603932986250; Wed, 28 Oct 2020 17:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603932986; cv=none; d=google.com; s=arc-20160816; b=PdjyFU+4h+NvoVbnWIVVJSqbSCV1ZDqCgM+YvA5vZyG5ECoeJDHZSb7fig9sfxIiml tojl+OsiWvfBLz7gt7J0s+8Snkc+IG3qVE6wJ8NUaRGuh5DcPrlb/B4pH0t3SB6z1YzY dB34lyPuHCMF54n4BWspNQa/3mDtX9lyjQ5dq/2CVw62OHRVe/9FeOebx5Ub+oIBijSQ lfG3SA1Kvp/Peo6YRv/DhbyzUe8ux+cQbPIWSUkP/0GFswUwQgeu0/AIBLBxgfm/Vxp9 csmMEs1SEgm5zNE0/33GS0oTyxGZpNYabIifPMurTXrxSGwy9jN7IvdlHt+E6mBqUFuW fOqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=qzgYKCsiMnXsmskR2AeWiZoW4TSnZRw9RpEp8cpRUVw=; b=YeCImkPBnNjEX6u6cEz8XJvoAL8TkUgHah410g/WQeMqAj1E51q70PwN7+tji2nW4n 6LDc1hNg+FRc0/5z4b1jS2LHx6hdKcZAU489LSU+bDWHIa5+xxQqhQJM4QPdrDHelPOV zhRLUkP1RDQJTjN1MN4hN6LLHa/KxwRftWtbv6qfGnzTqwZi0fQR1Cv/iEmq7RjZmX4y GqwI5+Dte7q+3EtetCuBl6uivc98bssLOlzvgXFbvnxjAcIddMku7vgGHxF/pT8b7z5+ zkA8ID6gmg4dZiY/BBLKr7FKJk8hqrUYSM2ejNarzeDzMSWcFMzbJfRPNDfs0XxZ/TxX vX2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zxa2ZHOR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si943243edd.30.2020.10.28.17.56.04; Wed, 28 Oct 2020 17:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zxa2ZHOR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727832AbgJ1Vsh (ORCPT + 99 others); Wed, 28 Oct 2020 17:48:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbgJ1Vsg (ORCPT ); Wed, 28 Oct 2020 17:48:36 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0297C0613CF for ; Wed, 28 Oct 2020 14:48:35 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id t3so652278wmi.3 for ; Wed, 28 Oct 2020 14:48:35 -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=NmAjiZ/GACrz5JB+ct/Q7VnHMSSVn16NZiqZbGX+VC5TnCMnOZcXOwenBQqP61r8rZ ztpyJjp5zzFczttrwaNNwA+80DaJwBNYIXzcI65qJzm2d3da8nlMDW/iapuTNdxSpmKq G+kk8SvxJFsTxBtGDBZ73OBJcalqYFaWV8tOBsebflC/YpIs2fpa4zCbuIScHMvgBuUY EUgQAGROoCRyyIAbOL7rlWzc/z/Fe7PtTmvVT0+T/IKdbNvo8FxMtvW4DgzUr591LQ5Y CA3AG1uMkhtaQb5mVR+9ja5vu/o0PHb9iPiOANrQY3YW0Zh18qxMlBpW+ZeXA9Vg1xJQ rKSw== X-Gm-Message-State: AOAM532L0zEGoDhwf93rLxrrB2lwEgzaVWa05QUjDLRSAb6mwW1gIRVP JMQtJofkAAW/Q8zrLoAMAwGpa/qAYLjYWQ== 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 Cc: suzuki.poulose@arm.com, alexander.shishkin@linux.intel.com, lcherian@marvell.com, Mike Leach 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); -- 2.17.1