From mboxrd@z Thu Jan 1 00:00:00 1970 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 B31B430D3F6; Thu, 16 Jul 2026 14:05:31 +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=1784210732; cv=none; b=N6YB8GSlb+7pTf0DiXWipGtwW68XTp0s3iSnFyhzfKfAwAi2L6lPvKh+ml5I2J5COCXPro+QuOy7IlO9McpOcfXrtjarKRIKM1dku9gGdifB8w6tW0JVjO7n/6VATIc559vMNEg/N9DtqKTxcvfDTZN+njIGMw9yzPy4XwItAkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784210732; c=relaxed/simple; bh=tRGTnS2kNQzPHhF33hI7fJVu10+UvqPFShoqm6cY64o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bshPGvyDqPWLEJeTwsAayP1qihY02M2so/W5hZ3rQWJe+PMwgUPdHnUrgtmADRpXhojBssZwAiVnn7fBgKUc4958XaegnMUoD+aRK5l8jz+2vtFq5Cem3izdzxxwZVkmOFpV3tMkGQuotb3hR/67S/P/RpDFf+2GRenMkIjefyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FiizZBKu; 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="FiizZBKu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2599F1F000E9; Thu, 16 Jul 2026 14:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784210731; bh=huyXtr9H/BfhFUN9gAB3w3j8+sUqORQ0+tRZYpML0DU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FiizZBKuZHAtKLUSUEx0u9U5EIIc+WBeP3MZX39UjgLmBa4sLohV48oHdw6jjxZwx SzdR2ZVoS8Xtiw2UDNLYxGMkl7MQPLJIEPxvq2CVKeFJ1lE0czY/RFQ9cJClxoBprW uyZA4H34i7UB4DUyKOK10fjPTnArDph7i1oVK60E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ricardo Ribalda , Hans Verkuil Subject: [PATCH 6.18 159/480] media: staging: ipu3-imgu: Add range check for imgu_css_cfg_acc_stripe Date: Thu, 16 Jul 2026 15:28:26 +0200 Message-ID: <20260716133048.148445356@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133044.672218725@linuxfoundation.org> References: <20260716133044.672218725@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 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ricardo Ribalda commit c32fe4c4918c9aa49f61359e3b42619c4d8686de upstream. If the driver's stripe information is invalid it can result in an integer underflow. Add a range check to avoid this kind of error. This patch fixes the following smatch error: drivers/staging/media/ipu3/ipu3-css-params.c:1792 imgu_css_cfg_acc_stripe() warn: 'acc->stripe.bds_out_stripes[0]->width - 2 * f' 4294967168 can't fit into 65535 'acc->stripe.bds_out_stripes[1]->offset' Cc: stable@vger.kernel.org Fixes: e11110a5b744 ("media: staging/intel-ipu3: css: Compute and program ccs") Signed-off-by: Ricardo Ribalda Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/ipu3/ipu3-css-params.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/staging/media/ipu3/ipu3-css-params.c +++ b/drivers/staging/media/ipu3/ipu3-css-params.c @@ -1770,6 +1770,8 @@ static int imgu_css_cfg_acc_stripe(struc acc->stripe.bds_out_stripes[0].width = ALIGN(css_pipe->rect[IPU3_CSS_RECT_BDS].width, f); } else { + u32 offset; + /* Image processing is divided into two stripes */ acc->stripe.bds_out_stripes[0].width = acc->stripe.bds_out_stripes[1].width = @@ -1788,8 +1790,10 @@ static int imgu_css_cfg_acc_stripe(struc acc->stripe.bds_out_stripes[1].width += f; } /* Overlap between stripes is IPU3_UAPI_ISP_VEC_ELEMS * 4 */ - acc->stripe.bds_out_stripes[1].offset = - acc->stripe.bds_out_stripes[0].width - 2 * f; + offset = acc->stripe.bds_out_stripes[0].width - 2 * f; + if (offset > 65535) + return -EINVAL; + acc->stripe.bds_out_stripes[1].offset = offset; } acc->stripe.effective_stripes[0].height =