From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DCB1606A31A for ; Tue, 1 Dec 2026 12:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=eO3edQXh; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bcgSw7+B DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=EEIkMj6J/Vcb6Z+Tn32Aw47uegQUVnbzG0qEiUUyEKs=; b=eO3edQXh8B4lMw rMP9tow/SJHiU4WwYiqGVzmGHdnVzcg5BIYt3Uu3KeILWDVoguIMYE4tDzpaWz1D6GqZaR4p0MVD2 79cBDoKUTyTm76mQnb0oSeZi+TpT3B9xJRJYBnYBPrPidb5KkMurFXywljG9FxX9w6OXVRoClWBVL gpHNxi9nchXai9kETFCBgXJLe00t2VhdF8InfRzE6UqJV9Wl6iCprg/Xygpt53cWiKu+L1IVQTFoK /F/pN6yAmanm8mCfTYOrt5j8LQHmL2WMYdLBsLVds1G7B93dGRNfZFBW0IiEYLMUERI/wHB9RCgcC CXaraVEip1zdXCtKCVxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYNC5-00000007ob7-2Fuh; Tue, 01 Dec 2026 12:42:49 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYNC2-00000007oaT-1IAq for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2026 12:42:46 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id BEB68624F1; Tue, 1 Dec 2026 12:42:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95CCB1F00893; Tue, 1 Dec 2026 12:42:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796128965; bh=EEIkMj6J/Vcb6Z+Tn32Aw47uegQUVnbzG0qEiUUyEKs=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=bcgSw7+BH5/Xjl7p/hx86HjaQ96AIaANb5WcKUypb6S9tM8USwXmDPUWv19rkofJH ZwNnZQnEtTsuwLtNbsKc9h3g95k6U0CC22LmORHYxhcPmhd8iYjTLiy1ArUTnghG+h fqrwWnpFwP0UTohSNKU7DH/F6ZgMmGNSaT26R0ZVQvR7ef0MDRU6ELwBXcBJbErHdG IpuQbI83ZJnsvBTuBOfYWD/mi1j2+9991P6rY8FxDFsob7PY4jWC7dzj3ZM71Aod3I /o/PeaL/3s9h/+zZEq4ln938zdAIdWD2+KtAbVi9P0hU0OTgpipkGNYHSLuvdrC9L9 K0soWNWByzQRw== Message-ID: Date: Tue, 1 Dec 2026 13:42:42 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] media: stm32: dcmipp: pixelproc: Fix width limit for downsize block To: Lin Huiyi , hugues.fruchet@foss.st.com, alain.volmat@foss.st.com Cc: mchehab@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-media@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org References: From: Hans Verkuil Content-Language: en-US, nl In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Alain, Can you review this? It sounds plausible, but someone with the datasheet should verify this. Regards, Hans On 29/11/2026 18:42, Lin Huiyi wrote: > The pixelproc subdev advertises a maximum width of > DCMIPP_FRAME_MAX_WIDTH (4096), but the downsize block target size > register DCMIPP_PxDSSZR stores the width in a 12-bit field > (GENMASK(11,0)) which can hold at most 4095. Composing a full > 4096-pixel wide stream therefore writes 4096 into the register, > setting bit 12 outside of the HSIZE field and leaving the field > itself at 0. > > Clamp the pixelproc width to the largest value the field can > represent (4095). > > Fixes: 239cf9e5fda1 ("media: stm32: dcmipp: pixelproc: addition of dcmipp-pixelproc subdev") > Signed-off-by: Lin Huiyi > --- > .../platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c > index 7d8e5f0863..779c898793 100644 > --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c > +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c > @@ -455,8 +455,14 @@ dcmipp_pixelproc_adjust_fmt(struct dcmipp_pixelproc_device *pixelproc, > if (!vpix) > fmt->code = PIXELPROC_MEDIA_BUS_FMT_DEFAULT; > > + /* > + * The downsize target size register DCMIPP_PxDSSZR stores the > + * output width in a 12-bit field which can not hold > + * DCMIPP_FRAME_MAX_WIDTH, clamp the width to the largest value > + * the field can represent. > + */ > fmt->width = clamp_t(u32, fmt->width, DCMIPP_FRAME_MIN_WIDTH, > - DCMIPP_FRAME_MAX_WIDTH); > + DCMIPP_PxDSSZR_HSIZE_MASK); > fmt->height = clamp_t(u32, fmt->height, DCMIPP_FRAME_MIN_HEIGHT, > DCMIPP_FRAME_MAX_HEIGHT); >