Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp81921rdb; Wed, 18 Oct 2023 19:35:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzohvKG8UkE4gW5XbKPWnEusf2Xfc4QN1TAJKT/LbiWbwJMzaemSf+PxUjQ/OfPXHGuzbU X-Received: by 2002:a05:6a20:7f99:b0:15e:a46f:fcfc with SMTP id d25-20020a056a207f9900b0015ea46ffcfcmr1272187pzj.21.1697682952892; Wed, 18 Oct 2023 19:35:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697682952; cv=none; d=google.com; s=arc-20160816; b=ksFaqF5p+wjPke4lPbHvDtqck3bUue8ho2IiS1WE+qIDDVCxTnpGHGAHu8OMmdN/jB QPZNei+8OjAw0T4ceQpjP9TbKaLxPCQg8Y0JGR5n1SmRougo9dZjF4a9O4z94xZ31ha/ xoV1/qpHxWgkNmivt2p3+nTAWfk9HF3YYM35B8qVMuyk+zHxSS4z/vNFSj7SFGPWOpaf b9TKZxZuNAg6VMi328sNK4+csaun+GHZWBQA22kRcT8wbfjdWTbQUI6jjABwnZNdaa1G YrOZiZVcckHSKCE+hZT6EHakIc/il4sZ6gRAyrMnVswU3Iq3a2VBu1mO6S/2xCravDRC xjZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject :cc; bh=YId0kQ1MP5SJPXAdXQnlOm3PXtiGyttrhtI8cq1lf40=; fh=fRHQ5dg2enkoP+/tM37WZ2kluuA59PutE0yX1DPxHoA=; b=K2k+EAOEDUuZ/RDpLZ4PMBbNomyNqALY2c2tZqsKfct4Tk+0yLGp1dGBhCaglBEQTs IhdkSKHy0/uTkNaoD++qINE79ka2SX8xIawQKG065EIyo9s5VMCT9TUYwUvRFqdNLmNE aVnvjelklYVVhmkrsgAjeIvT753c0L5BIpyCbtxYwCv3ulRRM+5PwkZiPjyuemG2HBAY wIqhgJPyTEzg5uHfsy2dU5D+W4WEPk7Ea90iheEClhjXjqM88Ycjj/U2OFe6T58xP7EU GTqMbqV7VIrP1knMH3RQ4Ht7kLGNZ8xxeKujrvxstIoKsgu4XH33sZn1AQR2CK0iVili 3KKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id s14-20020a170902b18e00b001bba894ac4asi1178993plr.274.2023.10.18.19.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 19:35:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5208C808D23A; Wed, 18 Oct 2023 19:35:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232340AbjJSCfC (ORCPT + 99 others); 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 X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 18 Oct 2023 19:35:34 -0700 (PDT) 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; > } >