[PATCH v3 14/22] accel: ethosu: Account for feature map element size
From: Rob Herring (Arm)
Date: Tue Sep 08 2026 - 18:07:50 EST
The feature map bounds calculation currently accounts for only one byte
of the final element. This can leave the tail of B16, B32, and B64
elements outside the validated buffer.
Use the feature map element size when calculating the final byte.
Fixes: 5a5e9c0228e6 ("accel: Add Arm Ethos-U NPU driver")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: Rob Herring (Arm) <robh@xxxxxxxxxx>
---
v2:
- new patch
---
drivers/accel/ethosu/ethosu_gem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/ethosu/ethosu_gem.c b/drivers/accel/ethosu/ethosu_gem.c
index 11aa3f4dd0e7..974cf562ef49 100644
--- a/drivers/accel/ethosu/ethosu_gem.c
+++ b/drivers/accel/ethosu/ethosu_gem.c
@@ -426,7 +426,7 @@ static u64 feat_matrix_length(struct ethosu_device *edev,
return U64_MAX;
}
- if (check_add_overflow(addr, 1ULL, &offset))
+ if (check_add_overflow(addr, (u64)element_size, &offset))
return U64_MAX;
info->region_size[fm->region] = max(info->region_size[fm->region], offset);
--
2.53.0