Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lin Huiyi <xinghui79@qq.com>
To: detlev.casanova@collabora.com, ezequiel@vanguardiasur.com.ar
Cc: mchehab@kernel.org, heiko@sntech.de, linux-media@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Lin Huiyi <xinghui79@qq.com>
Subject: [PATCH] media: rkvdec: vdpu383: Fix off-by-one in DPB POC setup
Date: Mon, 30 Nov 2026 16:28:31 +0800	[thread overview]
Message-ID: <tencent_686D20895E59693EE0103399340AD321AC09@qq.com> (raw)

The REF_PIC_POC() and REF_IS_VALID() bitwriter fields only describe 15
entries (i: 0-14), with RESERVED3/RESERVED4 occupying the position a
16th entry would take. The reference address loop in the same function
already uses ARRAY_SIZE(dpb) - 1 for exactly this reason.

Commit 4ae45bf4663e ("media: rkvdec: vdpu383: Drop bitfields for the
bitwriter") replaced the hand-written 15 assignments with a loop over
the full 16-element dpb array. With 16 active DPB entries, the extra
iteration writes the 16th POC and valid flag into the reserved fields,
which the old code left zeroed.

Limit the loop to 15 entries to match the field definitions and the
hardware's reference address programming.

Fixes: 4ae45bf4663e ("media: rkvdec: vdpu383: Drop bitfields for the bitwriter")
Signed-off-by: Lin Huiyi <xinghui79@qq.com>
---
 drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c
index 3462d995d4..6a8ea5b193 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c
@@ -313,7 +313,7 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx,
 	// Setup POC information
 	rkvdec_set_bw_field(hw_ps->info, CURRENT_POC, dec_params->pic_order_cnt_val);
 
-	for (i = 0; i < ARRAY_SIZE(dec_params->dpb); i++) {
+	for (i = 0; i < ARRAY_SIZE(dec_params->dpb) - 1; i++) {
 		rkvdec_set_bw_field(hw_ps->info, REF_IS_VALID(i),
 				    !!(dec_params->num_active_dpb_entries > i));
 		rkvdec_set_bw_field(hw_ps->info, REF_PIC_POC(i),
-- 
2.56.1



                 reply	other threads:[~2026-11-30  8:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=tencent_686D20895E59693EE0103399340AD321AC09@qq.com \
    --to=xinghui79@qq.com \
    --cc=detlev.casanova@collabora.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    /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