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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57930CDB47E for ; Thu, 19 Oct 2023 02:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232387AbjJSCfC (ORCPT ); Wed, 18 Oct 2023 22:35:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjJSCfB (ORCPT ); Wed, 18 Oct 2023 22:35:01 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92A9C124 for ; Wed, 18 Oct 2023 19:34:57 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9sDq37GszrSB5; Thu, 19 Oct 2023 10:32:11 +0800 (CST) Received: from [10.67.121.177] (10.67.121.177) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 19 Oct 2023 10:34:55 +0800 CC: , , , , , , , , Subject: Re: [PATCH 3/3] coresight: ultrasoc-smb: fix uninitialized before use buf_hw_base To: Junhao He References: <20231012094706.21565-1-hejunhao3@huawei.com> <20231012094706.21565-4-hejunhao3@huawei.com> From: Yicong Yang Message-ID: Date: Thu, 19 Oct 2023 10:34:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20231012094706.21565-4-hejunhao3@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.177] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/10/12 17:47, Junhao He wrote: > In smb_reset_buffer, the sdb->buf_hw_base variable is uninitialized > before use, which initializes it in smb_init_data_buffer. And the SMB > regiester are set in smb_config_inport. > So move the call after smb_config_inport. > > Fixes: 06f5c2926aaa ("drivers/coresight: Add UltraSoc System Memory Buffer driver") > > Signed-off-by: Junhao He > --- > drivers/hwtracing/coresight/ultrasoc-smb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c > index e78edc3480ce..21ba473786e5 100644 > --- a/drivers/hwtracing/coresight/ultrasoc-smb.c > +++ b/drivers/hwtracing/coresight/ultrasoc-smb.c > @@ -475,7 +475,6 @@ static int smb_init_data_buffer(struct platform_device *pdev, > static void smb_init_hw(struct smb_drv_data *drvdata) > { > smb_disable_hw(drvdata); > - smb_reset_buffer(drvdata); > > writel(SMB_LB_CFG_LO_DEFAULT, drvdata->base + SMB_LB_CFG_LO_REG); > writel(SMB_LB_CFG_HI_DEFAULT, drvdata->base + SMB_LB_CFG_HI_REG); > @@ -597,6 +596,7 @@ static int smb_probe(struct platform_device *pdev) > } > > platform_set_drvdata(pdev, drvdata); > + smb_reset_buffer(drvdata); Shouldn't we reset the buffer before registering the sink? Otherwise it'll be possible for user to access an unreset one. > > return 0; > } >