aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ras
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2024-01-31 11:24:25 +0300
committerBorislav Petkov (AMD) <bp@alien8.de>2024-01-31 09:44:06 +0100
commita7b57372e1c5c848cbe9169574f07a9ee2177a1b (patch)
tree9d7b18d8a22f848b94fb61002588dc4456c9e43d /drivers/ras
parent453f0ae797328e675840466c80e5b268d7feb9ba (diff)
downloadlinux-a7b57372e1c5c848cbe9169574f07a9ee2177a1b.tar.gz
RAS/AMD/ATL: Fix array overflow in get_logical_coh_st_fabric_id_mi300()
Check against ARRAY_SIZE() which is the number of elements instead of sizeof() which is the number of bytes. Fixes: 453f0ae79732 ("RAS/AMD/ATL: Add MI300 support") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/279c8b5e-6c00-467a-9071-9c67926abea4@moroto.mountain
Diffstat (limited to 'drivers/ras')
-rw-r--r--drivers/ras/amd/atl/denormalize.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ras/amd/atl/denormalize.c b/drivers/ras/amd/atl/denormalize.c
index d5d0e1fda1590..49a900e066f13 100644
--- a/drivers/ras/amd/atl/denormalize.c
+++ b/drivers/ras/amd/atl/denormalize.c
@@ -405,7 +405,7 @@ static const u16 phy_to_log_coh_st_map_mi300[] = {
static u16 get_logical_coh_st_fabric_id_mi300(struct addr_ctx *ctx)
{
- if (ctx->inst_id >= sizeof(phy_to_log_coh_st_map_mi300)) {
+ if (ctx->inst_id >= ARRAY_SIZE(phy_to_log_coh_st_map_mi300)) {
atl_debug(ctx, "Instance ID out of range");
return ~0;
}