From patchwork Thu Oct 29 16:45:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11866877 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 A4A5BC55179 for ; Thu, 29 Oct 2020 16:46:44 +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 2C33320EDD for ; Thu, 29 Oct 2020 16:46:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LYMFrsC0"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Vb8sYjuS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C33320EDD 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=mFyKsFrzN8jP4VAgx8kuJCuftbZTT/+m8ycO7Wbv9wU=; b=LYMFrsC0qg53eaWHRI2g+o1jP GeA2HEGaEPAuSsQTgKsXM2gl0PL19pMhbcWVF59hNFI8ReAivn6Qeay0c2/unh9htu0VN1pLMyn++ hekmjlTlNHkf8bxm6VVCt9iOzQR4F3sfp9kziATSWWtLWuL8sf/Qtbv0We66Q7VSdislGJK+Kt2Pv SozVXpsxX4epZQ+UgCmJ6OJlKaBV6i+J2DMldiTnPUtZcqfXHlNEKUSc4cG2Ms106LSEguTlClj/8 ZYS9CT5rhwAdq9iPqqncRKXt64vo42RMPX6VPkNB3q/0VSRF4SFKyEKun/eAEWAsrvM65HR1IbhS7 a3+fontHw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYB42-00009u-1a; Thu, 29 Oct 2020 16:46:14 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYB3t-000086-Qg for linux-arm-kernel@lists.infradead.org; Thu, 29 Oct 2020 16:46:06 +0000 Received: by mail-pg1-x543.google.com with SMTP id z24so2825339pgk.3 for ; Thu, 29 Oct 2020 09:46: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:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z7bva0Kz5DObj8A0pJjXfLrYcgFYUG/4s5PLhbnBJJc=; b=Vb8sYjuSR93wpGAF+QW0qHX6s7Ea1wJO2JmanNX1/eJtv5JwhWxpqjP5GWKdH9LKvv BETIVmS99TGyeZ3bRHFC1roW4rSoFaPFVwwZNsEQUsscS/IFkfHqOacJ6t5P1sYIW26k 51mlN3bfEou4WLzpIBP+E7kuppgdUvtSGemNTHR1LuvUp57h+uBWwmf8gvKpDEdHO5jh CSpeSegN9Es7d3ndqvSdx3vtPP7gJBZuUBziN35gmeB/Ek9NBIXaQ35Q9YqGrojJHMWR DeLLC78exKMaJLyQMhWSOKEusnnkcixn4G7hCKwEDxWjNPQe7Ugd8PZPJL4bjm0hmOfi ChRA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z7bva0Kz5DObj8A0pJjXfLrYcgFYUG/4s5PLhbnBJJc=; b=YGxFe/ztXRSBLgvNZGfFA/t0RZXhvstNEskA1Ny5gY2zwPLUuJBAqhhMDuXh0Vl6p2 Yytqr734hrMIHND4JZ9881FRpkxmxIXEMR0HceljcHkvgoLqwWGP9/rxZDiF8gKxXNeH Nr6I1DCiWYnK2BFIsjvsxpuFHnFbpa23OjvhDDq5QeziYT0F9filTTUj3azKbrMwPiBd llG07NWgE9cfINUbuhw+SkhqEGsFA0kvp1Pj3sKFkWcxd2IjrxdlNoi0SlbUokvmlJMb FV2UUveREXanSAowAy1r5LNHt9EuFZL8Ld2ikDLoE6LVF4Ba9xSVv02QEzS3mRNXbAI/ s/Sg== X-Gm-Message-State: AOAM5322tahsa8ogA7Qpd1LxniVQXKncA8pFMiGPkwCXoBampZF66Rgf kY0id4uSZAaeqEkprMdRaxLCsJ+DIXHnxQ== X-Google-Smtp-Source: ABdhPJwxAWLqmCga1pWNt8vcAjFLdgfeSA5KToKbMHjzF9UQcsIIyVtH/PnM0x6V0yr3EAVOwjnyJg== X-Received: by 2002:aa7:8b17:0:b029:15b:c0ba:f2f4 with SMTP id f23-20020aa78b170000b029015bc0baf2f4mr5126512pfd.22.1603989963483; Thu, 29 Oct 2020 09:46:03 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b7sm3625415pfr.171.2020.10.29.09.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 09:46:02 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 2/2] coresight: Fix uninitialised pointer bug in etm_setup_aux() Date: Thu, 29 Oct 2020 10:45:59 -0600 Message-Id: <20201029164559.1268531-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201029164559.1268531-1-mathieu.poirier@linaro.org> References: <20201029164559.1268531-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201029_124605_909782_486CE90B X-CRM114-Status: GOOD ( 17.06 ) 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-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Mike Leach 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 Signed-off-by: Mathieu Poirier --- 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);