mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Romain Gantois <romain.gantois@bootlin.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andi Shyti <andi.shyti@kernel.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Linus Walleij <linusw@kernel.org>, Felix Gu <ustc.gu@gmail.com>
Cc: linux-kernel@vger.kernel.org, Felix Gu <ustc.gu@gmail.com>
Subject: Re: [PATCH 1/2] misc: ti_fpc202: fix off-by-one error in port ID bounds check
Date: Thu, 26 Feb 2026 13:49:11 +0100	[thread overview]
Message-ID: <12878336.O9o76ZdvQC@fw-rgant> (raw)
In-Reply-To: <20260221-fp202-v1-1-4d28cb8b28fb@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]

On Friday, 20 February 2026 18:20:31 CET Felix Gu wrote:
> FPC202_NUM_PORTS is 2, valid port IDs should be 0 and 1. A port_id of 2
> would incorrectly pass the check, potentially causing out-of-bounds
> access to the port-related arrays.
> 
> Found by code review, compile pass.
> 
> Fixes: 1e5c9b1efa1c ("misc: add FPC202 dual port controller driver")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> 
>  drivers/misc/ti_fpc202.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
> index 8eb2b5ac9850..578feefb77f1 100644
> --- a/drivers/misc/ti_fpc202.c
> +++ b/drivers/misc/ti_fpc202.c
> @@ -366,7 +366,7 @@ static int fpc202_probe(struct i2c_client *client)
> 
>  			goto unregister_chans;
>  		
>  		}
> 
> -		if (port_id > FPC202_NUM_PORTS) {
> +		if (port_id >= FPC202_NUM_PORTS) {
> 
>  			dev_err(dev, "port ID %d is out of range!\n", port_id);
>  			ret = -EINVAL;
>  			goto unregister_chans;

Reviewed-by: Romain Gantois <romain.gantois@bootlin.com>


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-02-26 12:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 17:20 [PATCH 0/2] misc: ti_fpc202: two small fixes Felix Gu
2026-02-20 17:20 ` [PATCH 1/2] misc: ti_fpc202: fix off-by-one error in port ID bounds check Felix Gu
2026-02-26 12:49   ` Romain Gantois [this message]
2026-02-20 17:20 ` [PATCH 2/2] misc: ti_fpc202: remove dead code in fpc202_detach_addr() Felix Gu
2026-02-26 12:53   ` Romain Gantois

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=12878336.O9o76ZdvQC@fw-rgant \
    --to=romain.gantois@bootlin.com \
    --cc=andi.shyti@kernel.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ustc.gu@gmail.com \
    --cc=wsa+renesas@sang-engineering.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

all inboxes | Powered by JetHome®