From: Dan Carpenter <dan.carpenter@linaro.org>
To: Alexandru Hossu <hossu.alexandru@gmail.com>
Cc: parthiban.veerasooran@microchip.com,
christian.gromm@microchip.com, gregkh@linuxfoundation.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: most: video: fix read() length underflow
Date: Thu, 5 Mar 2026 09:30:29 +0300 [thread overview]
Message-ID: <aakjBUMpIKpFkAWY@stanley.mountain> (raw)
In-Reply-To: <20260305015703.41762-1-hossu.alexandru@gmail.com>
On Thu, Mar 05, 2026 at 02:57:03AM +0100, Alexandru Hossu wrote:
> Avoid unsigned underflow when fh->offs exceeds mbo->processed_length.
> Use size_t for length calculations and clamp invalid offsets.
>
> Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
> ---
No, this patch isn't correct or required. Look at how fh->offs is set.
It can't be more than processed_length. I was worried there might be a
race condition but that is prevented by the:
if (!atomic_inc_and_test(&mdev->access_ref)) {
which prevents multiple concurrent readers.
The other thing is that "count" can't be more than MAX_RW_COUNT so
ret is fine as an int. (Also it can't be more than
processed_length which is at most U16_MAX.)
With this kind of change I would want the commit message to have
an explanation of all the variables and the list of functions
where they are set. That shows you have done the analysis and it
speeds up my analysis as well as a reviewer.
regards,
dan carpenter
next prev parent reply other threads:[~2026-03-05 6:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 1:57 [PATCH] staging: most: video: fix read() length underflow Alexandru Hossu
2026-03-05 6:30 ` Dan Carpenter [this message]
2026-03-05 10:16 ` Alexandru Hossu
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=aakjBUMpIKpFkAWY@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=christian.gromm@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=hossu.alexandru@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=parthiban.veerasooran@microchip.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