From: Ismael Luceno <ismael@iodev.co.uk>
To: Ruoyu Wang <ruoyuw560@gmail.com>
Cc: linux-media@vger.kernel.org, maintainers@bluecherrydvr.com,
mchehab@kernel.org, bcollins@bluecherry.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: solo6x10: Initialize I2C read data
Date: Fri, 14 Aug 2026 02:33:18 +0200 [thread overview]
Message-ID: <an5iTu-BUjOV--UF@pirotess> (raw)
In-Reply-To: <20260813153120.3952770-1-ruoyuw560@gmail.com>
On 13/Aug/2026 23:31, Ruoyu Wang wrote:
> solo_i2c_readbyte() ignores the number of messages completed by
> i2c_transfer(). If the transfer stops before the read message completes,
> the adapter returns a short count without storing anything in data. The
> helper then returns an uninitialized stack byte, so chip detection and
> user-visible control and status reads can consume unpredictable values.
>
> The helper returns a byte and has no error channel. Preserve that API and
> initialize data to zero as a deterministic fallback. Successful reads
> still overwrite it, while failed or partial transfers no longer expose
> indeterminate stack contents.
>
> This issue was found by a static analysis checker and confirmed by manual
> source review.
>
> Fixes: faa4fd2a0951 ("Staging: solo6x10: New driver (staging) for Softlogic 6x10")
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
> ---
> drivers/media/pci/solo6x10/solo6x10-i2c.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/pci/solo6x10/solo6x10-i2c.c b/drivers/media/pci/solo6x10/solo6x10-i2c.c
> index 7db785e9c99791..1b37dccd137a05 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-i2c.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-i2c.c
> @@ -25,7 +25,7 @@
> u8 solo_i2c_readbyte(struct solo_dev *solo_dev, int id, u8 addr, u8 off)
> {
> struct i2c_msg msgs[2];
> - u8 data;
> + u8 data = 0;
>
> msgs[0].flags = 0;
> msgs[0].addr = addr;
> --
> 2.51.0
>
Nacked-by: Ismael Luceno <ismael@iodev.co.uk>
There's no guarantee that the buffer would remain zero on an error
condition.
But even then returning a zero on error here is a bad idea, the
interface needs some change.
prev parent reply other threads:[~2026-08-14 0:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 15:31 [PATCH] media: solo6x10: Initialize I2C read data Ruoyu Wang
2026-08-14 0:33 ` Ismael Luceno [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=an5iTu-BUjOV--UF@pirotess \
--to=ismael@iodev.co.uk \
--cc=bcollins@bluecherry.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=maintainers@bluecherrydvr.com \
--cc=mchehab@kernel.org \
--cc=ruoyuw560@gmail.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