Commit e30b64a3 authored by Dan Carpenter's avatar Dan Carpenter Committed by Thierry Reding

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: 31ab09b4 ("drivers: Add hardware timestamp engine (HTE) subsystem")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarDipen Patel <dipenp@nvidia.com>
Acked-by: default avatarDipen Patel <dipenp@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 0668e8cc
...@@ -811,7 +811,7 @@ int hte_push_ts_ns(const struct hte_chip *chip, u32 xlated_id, ...@@ -811,7 +811,7 @@ int hte_push_ts_ns(const struct hte_chip *chip, u32 xlated_id,
if (!chip || !data || !chip->gdev) if (!chip || !data || !chip->gdev)
return -EINVAL; return -EINVAL;
if (xlated_id > chip->nlines) if (xlated_id >= chip->nlines)
return -EINVAL; return -EINVAL;
ei = &chip->gdev->ei[xlated_id]; ei = &chip->gdev->ei[xlated_id];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment