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=-9.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 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 848F7C4363A for ; Thu, 29 Oct 2020 16:31:02 +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 E68322076E for ; Thu, 29 Oct 2020 16:31:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="luoVR8bX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JbVh5Klj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E68322076E 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: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=jLkBPmyVOWx2RJloIBLJ+tu7GpGPIWHqTC1WwFv5Tfo=; b=luoVR8bXbhEFemfVeEi9H5RIK /XEd/oqNAJmmHxu2VHgDZDKpRYdNRDUDUuTHvNG519SyErafb6F7M0/xWxVpUAdUym5RqJdG5tsFA zOIt/cSeMQignik9cORAuLCRnivunEzmxsOUhPHf8zUBvig9prsGX9RL7uvTo+JRMyf15xGZxiro5 Ok/0YeUtjOUI4/zUYkXZ5atBpRu2DNnyB6li5uZDU7dNp8Ylnsg2ev9AKWCg9dAG1k3RgtEnc+8pD OKzf7/5TNWVuGD3XJz+vvZJsSP/nErdzzP+ubuHRQmBnG9j52c2+eqER2ceChOGPSJfc4tCwLIOAX KOLMI2l2Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYAor-0006If-Kc; Thu, 29 Oct 2020 16:30:33 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYAok-0006EH-Jj for linux-arm-kernel@lists.infradead.org; Thu, 29 Oct 2020 16:30:30 +0000 Received: by mail-pl1-x641.google.com with SMTP id b19so1558960pld.0 for ; Thu, 29 Oct 2020 09:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=vcHK4825w50DBTSha+e++zZ+jcuoIRUk3Irih8jfEF8=; b=JbVh5KljJKPssEnSLGiN5zJB+T0YkdkDMs9rznkEcHglOK2pfptGo+wZrZZ2GYGpdd ppxCPrxB/jaQGj3vtvIFoDqW6VxCQR8u0JWWMJayiuuBWGOFEXOV+Hv6dX3fOiJYKGrD sRnPilkjkOXtqRIfWFXgO8h5q9sg5unQk/nJjwq5j6Q4HaXpAFASI82siftX1imeoO7c xqFClt4mW1nrAI48OW6A3lzoyvjNHPn+Ukz+g9fZMt+33nCOhl0ZSG50FZvRMXSdE7HB 7AzBKcnUnP5XDGMjOqDK5iFLHe7tS0LfHwnZXqLxWN0Mtna3v3xa/ux7b24dTl/cvFsJ Pjhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vcHK4825w50DBTSha+e++zZ+jcuoIRUk3Irih8jfEF8=; b=sgEOBLI8QFTxh71lyno1DF4L3sjHLyx8uqw32LQq3NtHSIoXOCnOXX5+WU75EejWbx p8grz2syaR8nGSr5gSAWYCHhUg/vsEtZ6QQz7pEuBvbjNJQOGSJcliKyz8Cv9HI7SiML ZoZACzQoZ6p7/7zFOyKEv1xJjyxsC46NdcvJRE2Uf+747iF5IJetuLqBv9e7sRqE7MJP MvVNwAXncWinTKNu0YcKrhFTrRWw07cry+iCg8P7bm2gW58nzigFz7fDGi1/IOKtS1uG oUl8Hml5KSZIv4ObtSRB46+2UdxYyY2vqr8jkiD6UH9pVC+cVIbmAmxvDm2mmu+Gs0IZ /Aug== X-Gm-Message-State: AOAM533z1t6aq+0IqiBnAjGoZuDCm+URDTgg/RklVyYt5kERsWIp+fn7 emp2qjHhNyzScc7WjDU4BhkXBw== X-Google-Smtp-Source: ABdhPJx2zoXJSVcH/cAX+n8ggt5fWcT6jJMKyX2fGiFI7NZ/eP1D68Jb9IerKmhJz/LrryNhnIaiuA== X-Received: by 2002:a17:902:a60c:b029:d5:dc92:a1ca with SMTP id u12-20020a170902a60cb02900d5dc92a1camr5074295plq.16.1603989020646; Thu, 29 Oct 2020 09:30:20 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id w19sm3567260pff.6.2020.10.29.09.30.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 09:30:19 -0700 (PDT) Date: Thu, 29 Oct 2020 10:30:17 -0600 From: Mathieu Poirier To: Mike Leach Subject: Re: [PATCH] coresight: Fix uninitialised pointer bug in etm_setup_aux() Message-ID: <20201029163017.GA1267404@xps15> References: <20201028174301.15033-1-mike.leach@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201028174301.15033-1-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201029_123026_803406_9CC105C0 X-CRM114-Status: GOOD ( 22.38 ) 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: suzuki.poulose@arm.com, alexander.shishkin@linux.intel.com, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, lcherian@marvell.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 28, 2020 at 05:43:01PM +0000, Mike Leach wrote: > 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; Yes, obviously - thanks for catching that. As checkpatch has complained about, the Fixes line you added isn't correct. It should have been: Fixes: bb1860efc817 ("coresight: etm: perf: Sink selection using sysfs is deprecated") I made the modification and applied to my tree. Thanks, Mathieu > struct etm_event_data *event_data = NULL; > > event_data = alloc_event_data(cpu); > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel