mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikhil Gurudasani <nikhilgurudasani314@gmail.com>
To: linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mchehab@kernel.org,
	hverkuil+cisco@kernel.org, crope@iki.fi,
	u.kleine-koenig@baylibre.com, kees@kernel.org
Subject: [PATCH 2/2] media: dvb-frontends: a8293: reject short probe reads
Date: Mon, 20 Jul 2026 06:37:45 +0530	[thread overview]
Message-ID: <20260720010745.11275-2-nikhilgurudasani314@gmail.com> (raw)
In-Reply-To: <20260720010745.11275-1-nikhilgurudasani314@gmail.com>

a8293_probe() treats any non-negative i2c_master_recv() result as a
successful two-byte probe read. A short transfer can therefore leave part
of the buffer uninitialized while probe still succeeds.

Require the exact transfer length and convert a short transfer to
-EREMOTEIO.

Fixes: 2c509b866bd2 ("[media] a8293: use i2c_master_send / i2c_master_recv for I2C I/O")
Signed-off-by: Nikhil Gurudasani <nikhilgurudasani314@gmail.com>
---
 drivers/media/dvb-frontends/a8293.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/a8293.c b/drivers/media/dvb-frontends/a8293.c
index 14e7f6bda10c..27ad8d12c53d 100644
--- a/drivers/media/dvb-frontends/a8293.c
+++ b/drivers/media/dvb-frontends/a8293.c
@@ -234,8 +234,11 @@ static int a8293_probe(struct i2c_client *client)
 
 	/* check if the SEC is there */
 	ret = i2c_master_recv(client, buf, 2);
-	if (ret < 0)
+	if (ret != 2) {
+		if (ret >= 0)
+			ret = -EREMOTEIO;
 		goto err_kfree;
+	}
 
 	/* override frontend ops */
 	fe->ops.set_voltage = a8293_set_voltage;
-- 
2.43.0


      reply	other threads:[~2026-07-20  1:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20  1:07 [PATCH 1/2] media: dvb-frontends: a8293: validate platform data Nikhil Gurudasani
2026-07-20  1:07 ` Nikhil Gurudasani [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=20260720010745.11275-2-nikhilgurudasani314@gmail.com \
    --to=nikhilgurudasani314@gmail.com \
    --cc=crope@iki.fi \
    --cc=hverkuil+cisco@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=u.kleine-koenig@baylibre.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®