Message ID | 20220308131657.1722495-1-mirela.rabulea@oss.nxp.com |
---|---|
State | Accepted |
Commit | e490fa1be5fe820029aa2ff2f70bcbbcebc11d28 |
Headers | show
Return-Path: <linux-media-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B63FC433FE for <linux-media@archiver.kernel.org>; Tue, 8 Mar 2022 13:17:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347081AbiCHNSQ (ORCPT <rfc822;linux-media@archiver.kernel.org>); Tue, 8 Mar 2022 08:18:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347176AbiCHNSI (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 8 Mar 2022 08:18:08 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4E6948E75; Tue, 8 Mar 2022 05:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KQqVUQZTYV5oOOsrJmI2CHIEmhlHjAHeMVqU2SmiObtOgGXOg/DbSgwixbIqZvldT/Kx2TleIoKXrIgXFKNkponxN9004r3Zvdb7Iz3Qj1Uc11L3IbPsMxyYN9wUeoMCECds0BpEXM2nVr4Mp/IlcFxBwFpFqHgfgCIsjkSA4MrzeQxfnlhqDZBGSdr9McJETFXH+LONeWlqIkVAjX5YVXo2a+M20s2E8+A/fFH0NfbufCQwIeb1Y/CeqA/oeeEJC72i57vsJgFN89b8sA8aDTa7XI16HkC+IbCzi6OuK5HYEhOUi82IIMtbVGgOx8HCNYhNJWkB1Rtx1rNnbwcjGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GpIn00TEzOeuqv1SGCj4edaQ8eXI5u/akvN31wF1dDc=; b=Y7BGY2Ty1lyiYgcJLz2tCgQsPYeoJ/N5w4bndPKEk/f9HfoZuKgOXuaEsER0WF2k6JbA4mebDAyY+LIjqkEPBYH2tZBbh1S3pvO7jekpl782/cj86yXU8Or5e0FVDFZba9sJN4MX1axqHyhNAyie0fjBYCYNjtqiGP947S+8KwagUtgssLi2Ii/RXD+znMbXpO9eFtR3MAazn/f7qGQFjK4gPHDfrQkn69irwS6jcxIk/gsIqJaQHBgMM9HFJ8mU6Iq0MoMSjTqcq/cJXq2ZdVTUmW8ZK+ZX7Is+PlEvaLwLBzheV/NplVj7uafm8ROGCLUBM9R33Js9hQ0z77LqDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GpIn00TEzOeuqv1SGCj4edaQ8eXI5u/akvN31wF1dDc=; b=d0lsQQT5CURsnswMHAqoKkV9B+daMd9gpZME4PjDHcebF2ise3lxUV+xUk59S/mpa/T7ltVMtkDQsnUXvQWcvJuYH/j6VPNf2jC6bBlAOwiqc6PvGHfyClqFJsW5oDNyUSz2JHbK0a6MclzPinziUos8T18nZNBfXg2zL5J3km8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR0401MB2495.eurprd04.prod.outlook.com (2603:10a6:800:52::15) by AM0PR0402MB3635.eurprd04.prod.outlook.com (2603:10a6:208:a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.16; Tue, 8 Mar 2022 13:17:08 +0000 Received: from VI1PR0401MB2495.eurprd04.prod.outlook.com ([fe80::a1ae:e74c:cadb:efb8]) by VI1PR0401MB2495.eurprd04.prod.outlook.com ([fe80::a1ae:e74c:cadb:efb8%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 13:17:08 +0000 From: Mirela Rabulea <mirela.rabulea@oss.nxp.com> To: mchehab@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, dan.carpenter@oracle.com, ming.qian@nxp.com Cc: linux-media@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, festevam@gmail.com, robert.chiras@nxp.com Subject: [PATCH] media: imx-jpeg: Fix potential array out of bounds in queue_setup Date: Tue, 8 Mar 2022 15:16:57 +0200 Message-Id: <20220308131657.1722495-1-mirela.rabulea@oss.nxp.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: VI1PR0902CA0050.eurprd09.prod.outlook.com (2603:10a6:802:1::39) To VI1PR0401MB2495.eurprd04.prod.outlook.com (2603:10a6:800:52::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5b3173e-5cf4-4a2b-9250-08da0105f296 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3635:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: <AM0PR0402MB36353E39EF45FAA99C8BB8ACCE099@AM0PR0402MB3635.eurprd04.prod.outlook.com> X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +FrNavQjw9oZRtAj0sPzXwxUiYFej6Hz8oYg0wKIwuYOZzIpTpxVd/9h7DKANIbGjwPota4vbTb+IjRtpi2eXoRKxfQcOLxI/KDjGO1rfT2ZhXC6o2dVA6XMORQHaSZ90Z80mXwy+Ox32R5JB9WhaeLpeHVqtoNS+c58KFA8fr7EPPj+Wbi/Ho7/IpeR/MPzimU6DFxYnPrKrbkjBSYH4Ig+B1FzbDq4OJjNBicWW5n6fHj21F1FX9uLIK+rTZmgTGX/OJikGLuvUhO4O2QrwdC9m1/YmcwKGYKMnT00rIYfWN8kKtXQhm6qT1tuTStBnfQxRPngZ8Z0iXcP0nAJOqcf6TBhgQ9xiaJ9mnP97uPslJLAk4lfxl+JeDC2C1JapGa30jHah9829e0x3PbpeKW0/abDqARNwJleT2bkY0o9LqGqvFTFz9tU7XHz/f0GiFWt1jTakOu2MnEcgHzJjJjaKgESBsHiVnioRViLq2Ln89IIF6lVav6evROkzTWM26A6W61ObKDHYTBX2aa50/up26mwxDPl/UPesvR6StG0K0UVzI9rqOyA3tTN+I/XD6OwXCdxLb4BZcIKmTRGthLXreCNfoIBcqXd8StjSFc2UtmzJb6XaSvr8JNBcc0SXZiK6lwEjZftb39305U3gtYp4A0ob0ykDedvGMTDZe5MQezjpX0z6/92Ry4AEMfjuK2jcc3YULV9/Q8hYMNnHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR0401MB2495.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(186003)(38350700002)(26005)(1076003)(66946007)(66556008)(86362001)(8676002)(2616005)(38100700002)(4326008)(498600001)(2906002)(66476007)(6486002)(83380400001)(6506007)(8936002)(6512007)(6666004)(52116002)(44832011)(4744005)(5660300002);DIR:OUT;SFP:1101; X-MS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I6d7lCIG4JdwvFUXn/WBxmjwF/Rrl3lVM7mB4SeuqvJ/7CFUP+0uFVgLt9H7ir3fARKaYipW6URTwK9weXmRbIROvdCNEZatw2rH/0k3PULKbfEex2pmBsJsXt5o18js53tPJree84+Hj7vmwYZw0lVLfE4MEN7MPvb45DLXBNZPZ9f7BllmjzM65EfiIqKUBeTMWNf9BaP+GUV8E11oWna0SS1b8/ijPxlCpCYuYZH+zEU4+lBAqoQ8DlLbXyozOcZkQ6dnwn0aNZ1cSzAhjSK8TIwMegghJsVxAEs0bIf1ospRKcvvaqfVW1pZBO0Uo3urS+S8whQfmUy6y3ziCFlUyHEVfXgr2bMszzbHFRet/QmCjdelmw1Xin3oG1IihZfdr4Ej3/Fk1bBZ6mnyENxl4/+6XnMJApaqAcSn+dwXhxuLwnkioxMmtDjXgChASp6fM0PbRgpPBRPEKE6veAbkTPxAzWnzvQuW21TsPzHJqJiRvKEBXwUEtnsh+5AmSUmpg0QoqGsjf1SiFYGh3L5qadUAffqSEnYluvklPK2e1pyDTmjm2c2Mm8Xp39bkDzadwZMs9BulRKO1jGxLJCrZxdkl/H3srFMFnRS0PSEsvUZY= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5b3173e-5cf4-4a2b-9250-08da0105f296 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2495.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 13:17:08.4639 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jmRSGuY9lKbK0UecmC0Ph57v+KowhADbi59Jf0UcyIefnbMV8BQg2a29mp9NIV15X0Xf+uOmmKOtZg38ed8vEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3635 Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Series |
media: imx-jpeg: Fix potential array out of bounds in queue_setup
|
expand
|
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;
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@oss.nxp.com> --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 2 ++ 1 file changed, 2 insertions(+)