summary refs log tree commit diff
path: root/drivers/hte
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2023-04-19 17:30:00 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-11 23:03:38 +0900
commitfed87ce073c7b9f4f255105f90bd930df06d18a7 (patch)
tree659accd3cccd7bd7076512bcc3067d8ba901d063 /drivers/hte
parenta51e150ef99890e73194a7b8faaf1a26fbee3782 (diff)
downloadlinux-fed87ce073c7b9f4f255105f90bd930df06d18a7.tar.gz
hte: tegra-194: Fix off by one in tegra_hte_map_to_line_id()
[ Upstream commit e078180d66848a6a890daf0a3ce28dc43cc66790 ]

The "map_sz" is the number of elements in the "m" array so the >
comparison needs to be changed to >= to prevent an out of bounds
read.

Fixes: 09574cca6ad6 ("hte: Add Tegra194 HTE kernel provider")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Dipen Patel <dipenp@nvidia.com>
Signed-off-by: Dipen Patel <dipenp@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/hte')
-rw-r--r--drivers/hte/hte-tegra194.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hte/hte-tegra194.c b/drivers/hte/hte-tegra194.c
index 49a27af22742..d1b579c82279 100644
--- a/drivers/hte/hte-tegra194.c
+++ b/drivers/hte/hte-tegra194.c
@@ -251,7 +251,7 @@ static int tegra_hte_map_to_line_id(u32 eid,
 {
 
 	if (m) {
-		if (eid > map_sz)
+		if (eid >= map_sz)
 			return -EINVAL;
 		if (m[eid].slice == NV_AON_SLICE_INVALID)
 			return -EINVAL;