lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220308131657.1722495-1-mirela.rabulea@oss.nxp.com>
Date:   Tue,  8 Mar 2022 15:16:57 +0200
From:   Mirela Rabulea <mirela.rabulea@....nxp.com>
To:     mchehab@...nel.org, shawnguo@...nel.org, s.hauer@...gutronix.de,
        dan.carpenter@...cle.com, ming.qian@....com
Cc:     linux-media@...r.kernel.org, linux-imx@....com,
        kernel@...gutronix.de, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, festevam@...il.com,
        robert.chiras@....com
Subject: [PATCH] media: imx-jpeg: Fix potential array out of bounds in queue_setup

Fix smatch warning in mxc_jpeg_queue_setup, check *nplanes against
current format:

drivers/media/platform/imx-jpeg/mxc-jpeg.c:1070
mxc_jpeg_queue_setup()
         warn: potential user controlled iterator 'i' (array size 2 vs 7)

Signed-off-by: Mirela Rabulea <mirela.rabulea@....nxp.com>
---
 drivers/media/platform/imx-jpeg/mxc-jpeg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
index fed762491379..f4819168c85d 100644
--- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c
+++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
@@ -1066,6 +1066,8 @@ static int mxc_jpeg_queue_setup(struct vb2_queue *q,
 
 	/* Handle CREATE_BUFS situation - *nplanes != 0 */
 	if (*nplanes) {
+		if (*nplanes != q_data->fmt->colplanes)
+			return -EINVAL;
 		for (i = 0; i < *nplanes; i++) {
 			if (sizes[i] < q_data->sizeimage[i])
 				return -EINVAL;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ