mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Hans Verkuil <hverkuil@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	linux-media@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH] media: v4l2-jpeg: do not rewind the stream after Huffman tables
Date: Tue, 01 Dec 2026 15:29:20 +0000	[thread overview]
Message-ID: <20261201-v4l2-jpeg-dht-rewind-v1-1-edf8b91a5c0f@gmail.com> (raw)

From: Arun Iyengar <aiyengar1990@gmail.com>

After the table loop len is normally 0, so jpeg_skip(stream, len - 2)
moves the stream back two bytes and the next marker search rescans the
end of the last table. Return 0, as the quantization table parser does.

Fixes: 50733b5b9102 ("media: add v4l2 JPEG helpers")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Host test, parser built in userspace: a DHT ending in FF C4 gives -EINVAL
before and 0 after; a normal header parses the same.
arm64 allmodconfig W=1 build is clean. Not run on coda hardware.

Developed with Claude (Anthropic) as a coding assistant, which wrote the
code and this message. I reviewed it.
---
 drivers/media/v4l2-core/v4l2-jpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-jpeg.c b/drivers/media/v4l2-core/v4l2-jpeg.c
index 36a0f1a1b0d9..8b80f4b5311b 100644
--- a/drivers/media/v4l2-core/v4l2-jpeg.c
+++ b/drivers/media/v4l2-core/v4l2-jpeg.c
@@ -525,7 +525,7 @@ static int jpeg_parse_huffman_tables(struct jpeg_stream *stream,
 		}
 	}
 
-	return jpeg_skip(stream, len - 2);
+	return 0;
 }
 
 /* B.2.4.4 Restart interval definition syntax */

---
base-commit: 95c189b26efb07257888ccf9d873a5c366aafbc6
change-id: 20261201-v4l2-jpeg-dht-rewind-7b1b800d9ace

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



             reply	other threads:[~2026-12-01 15:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 15:29 Arun Iyengar via B4 Relay [this message]
2026-12-01 16:19 ` Philipp Zabel

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=20261201-v4l2-jpeg-dht-rewind-v1-1-edf8b91a5c0f@gmail.com \
    --to=devnull+aiyengar1990.gmail.com@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=hverkuil@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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®