[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <537ffeb6-5b46-ebc7-cf48-19f9d628967c@huaweicloud.com>
Date: Sat, 20 May 2023 08:46:32 +0800
From: Li Nan <linan666@...weicloud.com>
To: Song Liu <song@...nel.org>, linan666@...weicloud.com
Cc: neilb@...e.de, Rob.Becker@...erbed.com, linux-raid@...r.kernel.org,
linux-kernel@...r.kernel.org, yukuai3@...wei.com,
yi.zhang@...wei.com, houtao1@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH OLK-5.10 v3 3/4] md/raid10: fix wrong setting of
max_corr_read_errors
在 2023/5/20 6:06, Song Liu 写道:
> On Mon, May 15, 2023 at 6:49 AM <linan666@...weicloud.com> wrote:
>>
>> From: Li Nan <linan122@...wei.com>
>>
>> max_corr_read_errors should not be negative number. Change it to
>> unsigned int where use it.
>>
>> Fixes: 1e50915fe0bb ("raid: improve MD/raid10 handling of correctable read errors.")
>> Signed-off-by: Li Nan <linan122@...wei.com>
>> Reviewed-by: Yu Kuai <yukuai3@...wei.com>
>> ---
>> drivers/md/md.c | 2 +-
>> drivers/md/raid10.c | 5 +++--
>> 2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/md/md.c b/drivers/md/md.c
>> index 5bba071ea907..b69ddfb1662a 100644
>> --- a/drivers/md/md.c
>> +++ b/drivers/md/md.c
>> @@ -4484,7 +4484,7 @@ __ATTR_PREALLOC(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_stor
>>
>> static ssize_t
>> max_corrected_read_errors_show(struct mddev *mddev, char *page) {
>> - return sprintf(page, "%d\n",
>> + return sprintf(page, "%u\n",
>> atomic_read(&mddev->max_corr_read_errors));
>> }
>
> max_corr_read_errors is atomic_t, so a signed integer. So these
> signed => unsigned changes are pretty error prone. Can we just
> add check in max_corrected_read_errors_store() so we never store
> a negative value?
>
> Thanks,
> Song
>
I will check input in v4
--
Thanks,
Nan
Powered by blists - more mailing lists