diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-04-19 16:30:00 +0200 |
---|---|---|
committer | Dipen Patel <dipenp@nvidia.com> | 2023-04-27 00:44:14 +0200 |
commit | e078180d66848a6a890daf0a3ce28dc43cc66790 (patch) | |
tree | 6b851828f5452c5376bad3300ef44e0d22f8930c /drivers/hte | |
parent | hte: tegra: fix 'struct of_device_id' build error (diff) | |
download | linux-e078180d66848a6a890daf0a3ce28dc43cc66790.tar.xz linux-e078180d66848a6a890daf0a3ce28dc43cc66790.zip |
hte: tegra-194: Fix off by one in tegra_hte_map_to_line_id()
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>
Diffstat (limited to 'drivers/hte')
-rw-r--r-- | drivers/hte/hte-tegra194.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hte/hte-tegra194.c b/drivers/hte/hte-tegra194.c index 2c485ff5be22..06ef349a2265 100644 --- a/drivers/hte/hte-tegra194.c +++ b/drivers/hte/hte-tegra194.c @@ -367,7 +367,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; |