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 5A87833A9FC; Tue, 21 Jul 2026 22:33:18 +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=1784673199; cv=none; b=tYkI4fbMrcFRpnfl6cVrxWtGe/tV2aty/zbX3mN/JwiEQer28vnH/UZE8yJ8gH6IK7wK45D3Dw+HMOvDUu3JzRGNaRV2A35TaA6xKErHdtw9K5SGvNqm4xKriMwwhI+X55Q848H4DAOVFKUj1aJqL6pL9ALFUQ5QeytG8/ZmSGI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784673199; c=relaxed/simple; bh=l2NNq/ZgAnHzJxeXoCXIskU3tlR7EPwQ+M9LaxZma/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c90OELfYyY2HK0bswG3jA45vLDuWwwvX+Bl+EL1xioKUYgoOr5hvnAFLR1YaBA/KYNrCDHYuJtsRKwe6OEK96uWEBorMkgtvQ9Ecko8xVCjMf/Y2EBD9dK/rGIjxnmksajsQ9SYqcnNrHXRwXwZ7dwcgyHG3VxjkGWTtRPapmJc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gRNt/24X; 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="gRNt/24X" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C13DD1F000E9; Tue, 21 Jul 2026 22:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784673198; bh=PuXQSpMKt8POg8MRTLfPTlxAoZ4IYGPaecefYaCYefI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gRNt/24XMcnvXaoFgSQ4iZz7vOJ6jQQbKU+IUn6A0o9wuVgfFZWDRkGj3qhCPdSXH 0e8VSGzynC/czK1x+8e9GAexTWUImnsLztSvhGnqSEDoQUfARD2w+ZQO7N+vA+/0Vq Aj6Agcg/MrRN9rKwJykqhoRUkoAdWUvUYEvl3EJc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ricardo Ribalda , Hans Verkuil Subject: [PATCH 5.10 071/699] media: staging: ipu3-imgu: Add range check for imgu_css_cfg_acc_stripe Date: Tue, 21 Jul 2026 17:17:10 +0200 Message-ID: <20260721152357.306291687@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@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 5.10-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 @@ -1773,6 +1773,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 = @@ -1791,8 +1793,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 =