summaryrefslogtreecommitdiff
path: root/drivers/hte
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-05-06 17:53:52 +0300
committerThierry Reding <treding@nvidia.com>2022-05-10 16:35:52 +0300
commite30b64a3ab9b9640e25b2ee6d7a9d70c1efd3b67 (patch)
treed41de1afdca0de00b2e397ac9829c23926151c92 /drivers/hte
parent0668e8ccd33122a350629f6583c880b62b40ab5d (diff)
downloadlinux-e30b64a3ab9b9640e25b2ee6d7a9d70c1efd3b67.tar.xz
hte: Fix off by one in hte_push_ts_ns()
The &chip->gdev->ei[] array has chip->nlines elements so this > comparison needs to be >= to prevent an out of bounds access. The gdev->ei[] array is allocated in hte_register_chip(). Fixes: 31ab09b42188 ("drivers: Add hardware timestamp engine (HTE) subsystem") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Dipen Patel <dipenp@nvidia.com> Acked-by: Dipen Patel <dipenp@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/hte')
-rw-r--r--drivers/hte/hte.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hte/hte.c b/drivers/hte/hte.c
index 891b98ad609e..a14c5bf290ff 100644
--- a/drivers/hte/hte.c
+++ b/drivers/hte/hte.c
@@ -811,7 +811,7 @@ int hte_push_ts_ns(const struct hte_chip *chip, u32 xlated_id,
if (!chip || !data || !chip->gdev)
return -EINVAL;
- if (xlated_id > chip->nlines)
+ if (xlated_id >= chip->nlines)
return -EINVAL;
ei = &chip->gdev->ei[xlated_id];