[PATCH openEuler-21.03] arm64/mpam: fix device_errcode out of bounds

From: yin-xiujiang <yinxiujiang@kylinos.cn> kylin inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4AHUH?from=project-issue CVE: NA --------------------------------------------------- the size of mpam_msc_err_str is _MPAM_NUM_ERRCODE, so device_errcode needs to be less than _MPAM_NUM_ERRCODE Signed-off-by: yin-xiujiang <yinxiujiang@kylinos.cn> --- arch/arm64/kernel/mpam/mpam_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/mpam/mpam_device.c b/arch/arm64/kernel/mpam/mpam_device.c index 86aaf52146bc..fd538fd22c6e 100644 --- a/arch/arm64/kernel/mpam/mpam_device.c +++ b/arch/arm64/kernel/mpam/mpam_device.c @@ -435,7 +435,7 @@ static irqreturn_t mpam_handle_error_irq(int irq, void *data) return IRQ_NONE; /* No-one expects MPAM errors! */ - if (device_errcode <= _MPAM_NUM_ERRCODE) + if (device_errcode < _MPAM_NUM_ERRCODE) pr_err_ratelimited("unexpected error '%s' [esr:%x]\n", mpam_msc_err_str[device_errcode], device_esr); -- 2.27.0

Reviewed-by: Wang ShaoBo <bobo.shaobowang@huawei.com> 在 2021/10/9 15:22, yinxiujiang 写道:
From: yin-xiujiang <yinxiujiang@kylinos.cn>
kylin inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4AHUH?from=project-issue CVE: NA
---------------------------------------------------
the size of mpam_msc_err_str is _MPAM_NUM_ERRCODE, so device_errcode needs to be less than _MPAM_NUM_ERRCODE
Signed-off-by: yin-xiujiang <yinxiujiang@kylinos.cn> --- arch/arm64/kernel/mpam/mpam_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/mpam/mpam_device.c b/arch/arm64/kernel/mpam/mpam_device.c index 86aaf52146bc..fd538fd22c6e 100644 --- a/arch/arm64/kernel/mpam/mpam_device.c +++ b/arch/arm64/kernel/mpam/mpam_device.c @@ -435,7 +435,7 @@ static irqreturn_t mpam_handle_error_irq(int irq, void *data) return IRQ_NONE;
/* No-one expects MPAM errors! */ - if (device_errcode <= _MPAM_NUM_ERRCODE) + if (device_errcode < _MPAM_NUM_ERRCODE) pr_err_ratelimited("unexpected error '%s' [esr:%x]\n", mpam_msc_err_str[device_errcode], device_esr);
participants (2)
-
Wangshaobo (bobo)
-
yinxiujiang