mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: hejunhao <hejunhao3@huawei.com>
To: Yicong Yang <yangyicong@huawei.com>
Cc: <james.clark@arm.com>, <suzuki.poulose@arm.com>,
	<yangyicong@hisilicon.com>, <coresight@lists.linaro.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>,
	<jonathan.cameron@huawei.com>, <prime.zeng@hisilicon.com>
Subject: Re: [PATCH 3/3] coresight: ultrasoc-smb: fix uninitialized before use buf_hw_base
Date: Thu, 19 Oct 2023 21:08:08 +0800	[thread overview]
Message-ID: <3e67ba5a-4022-0089-1ede-46f73ad70afa@huawei.com> (raw)
In-Reply-To: <fe5af067-d2f4-7967-e75b-272b00e6275f@huawei.com>


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.


      reply	other threads:[~2023-10-19 13:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12  9:47 [PATCH 0/3] Fixed some issues and cleanup of ultrasoc-smb Junhao He
2023-10-12  9:47 ` [PATCH 1/3] coresight: ultrasoc-smb: fix sleep while close preempt in enable_smb Junhao He
2023-10-19  3:05   ` Yicong Yang
2023-10-19 12:45     ` hejunhao
2023-10-19 13:30   ` Jonathan Cameron
2023-10-21  7:25     ` hejunhao
2023-10-12  9:47 ` [PATCH 2/3] coresight: ultrasoc-smb: simplify the code for check to_copy valid Junhao He
2023-10-19 13:35   ` Jonathan Cameron
2023-10-20  2:33     ` hejunhao
2023-10-12  9:47 ` [PATCH 3/3] coresight: ultrasoc-smb: fix uninitialized before use buf_hw_base Junhao He
2023-10-19  2:34   ` Yicong Yang
2023-10-19 13:08     ` hejunhao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e67ba5a-4022-0089-1ede-46f73ad70afa@huawei.com \
    --to=hejunhao3@huawei.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@arm.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=suzuki.poulose@arm.com \
    --cc=yangyicong@hisilicon.com \
    --cc=yangyicong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®