From: Li Nan linan122@huawei.com
hulk inclusion category: bugfix bugzilla: 188290, https://gitee.com/openeuler/kernel/issues/I6ECBD CVE: NA
--------------------------------
max_corr_read_errors should not be negative number. Change it to unsigned int where use it.
Signed-off-by: Li Nan linan122@huawei.com Reviewed-by: Hou Tao houtao1@huawei.com Signed-off-by: Jialin Zhang zhangjialin11@huawei.com --- drivers/md/md.c | 2 +- drivers/md/raid10.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c index 1af74721e67c..84f7db691335 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4563,7 +4563,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)); }
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 744b4abe2c3b..b13dcbe00c38 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2325,7 +2325,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 int sect = 0; /* Offset from r10_bio->sector */ int sectors = r10_bio->sectors; struct md_rdev *rdev; - int max_read_errors = atomic_read(&mddev->max_corr_read_errors); + unsigned int max_read_errors = atomic_read(&mddev->max_corr_read_errors); int d = r10_bio->devs[r10_bio->read_slot].devnum;
/* still own a reference to this rdev, so it cannot @@ -2344,7 +2344,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 char b[BDEVNAME_SIZE]; bdevname(rdev->bdev, b);
- pr_notice("md/raid10:%s: %s: Raid device exceeded read_error threshold [cur %d:max %d]\n", + pr_notice("md/raid10:%s: %s: Raid device exceeded read_error threshold [cur %u:max %u]\n", mdname(mddev), b, atomic_read(&rdev->read_errors), max_read_errors); pr_notice("md/raid10:%s: %s: Failing raid device\n",