Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83F7A563FCF; Wed, 9 Sep 2026 14:05:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788962758; cv=none; b=M/PNU3g+epYZ5v/FuG2rI/tW2zA+bZoMh96MvAs7q2aM24It4JAEoDB8TYnhgaM2zXXrCvqoEEMaqy2snrvVhj3VLiW1fYCCBWswK5t9/TSeEazasrFZ8nH66MJ7WBzit/+ItV61sHOBzzjgXzXRvgP12rViPpkcQP1i7oLs880= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788962758; c=relaxed/simple; bh=19OuLhskt1DSlTbsmpAhHj8qtVLn3Oo2KIYe4pO4qA0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e61HP53R8BeNiXna7bDbyP7+wm6lAdSlqJCd6B2vmj+vAtGN5zLvZKGsvBZo7RQ7VYdSnUJP236wA7vRLzLVCBUllFPxL4vEyxjLWDfeoMlKDpt0/6a8q/lnBFQ0Q10pO8B40TjmD0p7gJQJbdTyv/Skd6zUIV9aGcOBIJxe2RI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zXTmFKxq; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zXTmFKxq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE9531F00A3A; Wed, 9 Sep 2026 14:05:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788962757; bh=l72UNkfImDL0fHNx2nJrySECOJpN4NAviGkZfw0Hy/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zXTmFKxqybQYvgt8CB4aDai25hAkgK02+bAhyNZqRBrclDaOiNlFFUiL+K9T58hIp hfIpsub83+0vXa1fvlHnsAZrJ6+d1ONl9EfZntSHLWJEEiDKEmjOhQ6Vm2MyDL8Ug7 2Hlwn1/+j1Rf5b7UdBkfwaOmHwEJ3fMsDrmWOLSI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mohammed EL Kadiri , Dmitry Baryshkov , Bryan ODonoghue Subject: [PATCH 7.2 402/556] media: venus: fix payload size calculation in parse_raw_formats() Date: Wed, 9 Sep 2026 15:41:22 +0200 Message-ID: <20260909134244.773224816@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134230.441546314@linuxfoundation.org> References: <20260909134230.441546314@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mohammed EL Kadiri commit bd595b745eb770e80347c31ffc25351046935305 upstream. The consumed size is computed after the loop using the num_planes value from the last iteration for all entries. When entries have different plane counts, this produces an incorrect total. Accumulate the actual size during the loop instead. Fixes: 9edaaa8e3e15 ("media: venus: hfi_parser: refactor hfi packet parsing logic") Cc: stable@vger.kernel.org Signed-off-by: Mohammed EL Kadiri Reviewed-by: Dmitry Baryshkov Signed-off-by: Bryan O'Donoghue Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/qcom/venus/hfi_parser.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/media/platform/qcom/venus/hfi_parser.c +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -171,7 +171,7 @@ parse_raw_formats(struct venus_core *cor u32 entries = fmt->format_entries; unsigned int i = 0; u32 num_planes = 0; - u32 size; + u32 size = 2 * sizeof(u32); while (entries) { num_planes = pinfo->num_planes; @@ -186,6 +186,7 @@ parse_raw_formats(struct venus_core *cor if (pinfo->num_planes > MAX_PLANES) break; + size += sizeof(*constr) * num_planes + 2 * sizeof(u32); pinfo = (void *)pinfo + sizeof(*constr) * num_planes + 2 * sizeof(u32); entries--; @@ -193,8 +194,6 @@ parse_raw_formats(struct venus_core *cor for_each_codec(core->caps, ARRAY_SIZE(core->caps), codecs, domain, fill_raw_fmts, rawfmts, i); - size = fmt->format_entries * (sizeof(*constr) * num_planes + 2 * sizeof(u32)) - + 2 * sizeof(u32); return size; }