Skip to content

Commit e30b64a

Browse files
Dan Carpenterthierryreding
authored andcommitted
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: 31ab09b ("drivers: Add hardware timestamp engine (HTE) subsystem") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Dipen Patel <[email protected]> Acked-by: Dipen Patel <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 0668e8c commit e30b64a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hte/hte.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ int hte_push_ts_ns(const struct hte_chip *chip, u32 xlated_id,
811811
if (!chip || !data || !chip->gdev)
812812
return -EINVAL;
813813

814-
if (xlated_id > chip->nlines)
814+
if (xlated_id >= chip->nlines)
815815
return -EINVAL;
816816

817817
ei = &chip->gdev->ei[xlated_id];

0 commit comments

Comments
 (0)