Message ID | 20231012094706.21565-4-hejunhao3@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1100749vqb; Thu, 12 Oct 2023 02:47:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJWrA5S0bMGfFxFj0UeK5eNROZ3TVB5dDGvgLB/VHdopPXW/X2uFmoQVpRcVsA8akpDt0x X-Received: by 2002:a17:902:d352:b0:1c9:e121:ccc1 with SMTP id l18-20020a170902d35200b001c9e121ccc1mr980691plk.5.1697104053979; Thu, 12 Oct 2023 02:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697104053; cv=none; d=google.com; s=arc-20160816; b=07mEODpYuGY9aXgagDHjiOWgB4gztu8xj4m9XlND8ZeHwiJ1jAMymWG8EIjjVwU3h6 kZQffZOfeVhoHG8DPouEkxbULKem4PKbDiUy23L7F4uHb++vZM6i0B2DfI8M6e4Q0p5i jz5AXJqpLY39/ENw45IcOYn2WAQyXlFY5k7PFIK2SX/BYzCgmt2OfjSmYdv9mXxfJOvk nK18xmpT+UXrrxpPJugWx8bF18/BELx6XZ0jsG+eSEpk9Xek/J5ScNK46UERKEEWjJH/ HrPz2q11fLhWRywFgojUDLt2y9QsHhq3ksy+VofjOzPvawge73+KGscWdx+zpTgwAsEk /MtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ocaHFnXAh/dmVxSx/kePtDLMZoKFskKVe8OeuUuXhtQ=; fh=DAAgJLf4s0smpgJqxZKr7c0el7KScJ0FbfhkC9eFTa4=; b=MBbhIQVsah/LV+9EJmcA1uj6cVEFpAoaBWkI9zGu5jngSohAaStI14PTbpubOslG7u oU1nAVSKbZUd5xJGwGA/7tL94LEteLlRhYEsOpu/welmX98NeLIGvJIrfQITX3Q/Je2R +mg7YhwVUW0VIfaLwzvb9eIhYOHYyr89GTlZjtGxVdz6Hr19mxoiMc4r/4T7Hco0gzY6 vdxQUkzDAlHTDpo3QTEOEFEKupctuVMAsuNoUf0PPBt81eZqJM57gWpq8jy5UR4MCDEq 6eIl3c/BCScZxdICfkmYHYZTuRZA5AfmDHnItB9vRHTWjG6L2exptDTni4+VwAI+iSMA Y2qw== 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 Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id 19-20020a170902ee5300b001bbb175a81asi1751943plo.263.2023.10.12.02.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 02:47:33 -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 CE35B80310CE; Thu, 12 Oct 2023 02:47:12 -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 S235630AbjJLJqo (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Thu, 12 Oct 2023 05:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbjJLJqf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 12 Oct 2023 05:46:35 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF56B7 for <linux-kernel@vger.kernel.org>; Thu, 12 Oct 2023 02:46:32 -0700 (PDT) Received: from dggpeml500002.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4S5l6c23QYz1kv1T; Thu, 12 Oct 2023 17:42:32 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggpeml500002.china.huawei.com (7.185.36.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 12 Oct 2023 17:46:31 +0800 From: Junhao He <hejunhao3@huawei.com> To: <suzuki.poulose@arm.com>, <james.clark@arm.com> CC: <coresight@lists.linaro.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>, <jonathan.cameron@huawei.com>, <yangyicong@huawei.com>, <prime.zeng@hisilicon.com>, <hejunhao3@huawei.com> Subject: [PATCH 3/3] coresight: ultrasoc-smb: fix uninitialized before use buf_hw_base Date: Thu, 12 Oct 2023 17:47:06 +0800 Message-ID: <20231012094706.21565-4-hejunhao3@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231012094706.21565-1-hejunhao3@huawei.com> References: <20231012094706.21565-1-hejunhao3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500002.china.huawei.com (7.185.36.158) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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: <linux-kernel.vger.kernel.org> 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]); Thu, 12 Oct 2023 02:47:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779542580300109804 X-GMAIL-MSGID: 1779542580300109804 |
Series |
Fixed some issues and cleanup of ultrasoc-smb
|
|
Commit Message
hejunhao
Oct. 12, 2023, 9:47 a.m. UTC
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 <hejunhao3@huawei.com>
---
drivers/hwtracing/coresight/ultrasoc-smb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
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 <hejunhao3@huawei.com> > --- > 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; > } >
On 2023/10/19 10:34, Yicong Yang wrote: > 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 <hejunhao3@huawei.com> >> --- >> 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. > Hi Yicong, Thanks for the comments! The code after the smb_register_sink() function also needs to moved. I will fix all in next version. Best regards, Junhao.
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); return 0; }