From: Dipen Patel <dipenp@nvidia.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Thierry Reding <treding@nvidia.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] hte: fix off by one in hte_push_ts_ns()
Date: Fri, 6 May 2022 11:25:29 -0700 [thread overview]
Message-ID: <6e5ae4c2-abe2-048a-21b5-783f1c77bb08@nvidia.com> (raw)
In-Reply-To: <YnU2gHe+QZOAuNyV@kili>
good catch. Thanks.
Reviewed-by: Dipen Patel
Acked-by: Dipen Patel
On 5/6/22 7:53 AM, Dan Carpenter wrote:
> 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>
> ---
> drivers/hte/hte.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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];
prev parent reply other threads:[~2022-05-06 18:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 14:53 [PATCH 1/2] hte: fix off by one in hte_push_ts_ns() Dan Carpenter
2022-05-06 14:54 ` [PATCH 2/2] hte: uninitialized variable in hte_ts_get() Dan Carpenter
2022-05-06 18:21 ` Dipen Patel
2022-05-06 18:25 ` Dipen Patel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6e5ae4c2-abe2-048a-21b5-783f1c77bb08@nvidia.com \
--to=dipenp@nvidia.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=treding@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox