Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3011567pxx; Sun, 1 Nov 2020 19:14:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8d0begA5UOvTbsHLyNGHHQT9nnWpktUo1BQ69+Jni4jEdtF/I3C1nILf1cSJLCQuyuCTP X-Received: by 2002:a17:907:2175:: with SMTP id rl21mr10293440ejb.59.1604286881294; Sun, 01 Nov 2020 19:14:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1604286881; cv=pass; d=google.com; s=arc-20160816; b=VYJQ5iTtyE3A1AC5zeem/X9aH3X3FO954TTpGjJgpuRBm2kMze4rNKKnvFsji6mPkI hQ4DRMzV2ys9rKRcX6kfFr3r+8tKkn+AL+YIt8gM9KbbFER7U1nIQjA/kKMNmcTHVVPA COd17srO2gdTDWMiIACDyqkI5MnsiM6nzIR/g/4ZF4FQyCo87mjqOjJz9B1vUSvZduis hh0VShbgNSfFtZ0AjgBRMA03BlPisZ/R+Dh9y52l0QHvZMYVcFACErDy4XH7yXCLIMG0 gp7yfMb7HtYeF5XH0V3WrwuEE/geBJwIdLL4NqXq/1od7sZSpdW7PFfhxeejGVEYe0Ta Fu8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=eHViFV9Q3waoAMKcQmF/huSPngMu26WkcFNEdvDXlnE=; b=oJPcihgp95BZgYQUfsljw0So5Zqszll8uOyt/BRZwi4GcY29l/NY0z/T9DGxJvGHY0 S2J1cBkuFvrL2w9D+G3WJdLgKLIljElJxiypcO/uq+Dt3GP1rdjff5gfJin+TPjtjs38 5c+hyxbpAq6CnHmT/vKz7T/Ni+iSMCwTJy9l0t1PoO/qG+RsLf6hNBeFg+wbW8v/uPCv qcYXEBH1XDyfWIaY8bQxCnnFv0rtfqcAX4dkWQNK8cRzzESPNrPMEeXpoQORorMBt9sk jmAnq1iZLaboUu7NSvWDN0EH6B5Kyxt/KndYYbA6X7sgtS3PEWaZHx4R9MSkUbv1QRTj vVbQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=afByRzLr; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w15si11621129edf.56.2020.11.01.19.14.19; Sun, 01 Nov 2020 19:14:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=afByRzLr; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727944AbgKBDKg (ORCPT + 99 others); Sun, 1 Nov 2020 22:10:36 -0500 Received: from mail-am6eur05on2083.outbound.protection.outlook.com ([40.107.22.83]:60192 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727908AbgKBDKe (ORCPT ); Sun, 1 Nov 2020 22:10:34 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N6v17voBbLJtf8OLghCbHPP5FeZVPUNGJmhZr5/qAECzRUBgC3Zc4LNiYV0fIlJxm/KWoB8bBz37yCaXlwaU4P5K66zW3oDG4S56HaTuisgpnBM342xsd++I8wgfyibzOUQSX8uKCpI1Wx5aylB9VozGSeUp8xQCM6pQt/TxqutqUmHZ2y/kEFWK17+AZ67K0iWGjyzfzAU0FhrKaM761iUQS+flycMjSly/hpjGl6h3FFvzocg+nlAHpwEft2yHOGx1iBid6RMtcpbbB4lwF0oz7amrfxz5+ucWaj/zdaIWQXyFAtGXs37QBMLyJLsYQ8R35vvsKmar0d4b80/zWg== 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-SenderADCheck; bh=eHViFV9Q3waoAMKcQmF/huSPngMu26WkcFNEdvDXlnE=; b=MqW8qd3ABbSlRpasSDfcdxAs4P+YH+/CiDPTqWQuZmX86JFX+VSRGmU+cs0zlT3iObWzDc1BiCZiiiFYlxOZtb8RhWiAZ6meELWXAzv6xKdE7m2C+lXBGmO6DVVBuGGXOuLFqojkN4L7wEMOtn+LqCPOyKKAbG8qpLYwmg9Myodue4ZCXRMHfXT9kK7uLGTne9mzf8Rn8LIUw4tEnbgcOUUfdUZpDNbgWbEW0w905wPvp2sR23B5BZgY/9o5zU/NZgbbK4eWq2lEtN1AQFwTB2QkgHX++J43Qw3JrUyk09yaWXWQ0Tiz6bz1BEkf8jo7ztDudx2qIIDhhJhBARz7Jw== 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=eHViFV9Q3waoAMKcQmF/huSPngMu26WkcFNEdvDXlnE=; b=afByRzLr/CmJu2SJDtaxc035IIKBRjNQE1HhCF2b/lYHtqE9H0Yjyyxv9zqKH0kG9yEi0K6CMYQZUtOoYDe9BDnPm3eWnMIHXDXB5U4601W1ntv5W51s+9PulFoIOVfeOS82i0IkZZ46C74KY+27GmFRkyVkBdSo16QoFP07m8g= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) by AM6PR04MB5173.eurprd04.prod.outlook.com (2603:10a6:20b:d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Mon, 2 Nov 2020 03:10:11 +0000 Received: from AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9]) by AM5PR04MB3137.eurprd04.prod.outlook.com ([fe80::2d75:aaf5:5aa6:5de9%6]) with mapi id 15.20.3499.029; Mon, 2 Nov 2020 03:10:11 +0000 From: "Mirela Rabulea (OSS)" To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, shawnguo@kernel.org, robh+dt@kernel.org Cc: paul.kocialkowski@bootlin.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, s.hauer@pengutronix.de, aisheng.dong@nxp.com, daniel.baluta@nxp.com, robert.chiras@nxp.com, laurentiu.palcu@nxp.com, mark.rutland@arm.com, devicetree@vger.kernel.org, p.zabel@pengutronix.de, ezequiel@collabora.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, dafna.hirschfeld@collabora.com, Mirela Rabulea Subject: [PATCH v4 10/11] media: Avoid parsing quantization and huffman tables Date: Mon, 2 Nov 2020 05:08:20 +0200 Message-Id: <20201102030821.3049-11-mirela.rabulea@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> References: <20201102030821.3049-1-mirela.rabulea@oss.nxp.com> Content-Type: text/plain X-Originating-IP: [86.124.170.94] X-ClientProxiedBy: AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) To AM5PR04MB3137.eurprd04.prod.outlook.com (2603:10a6:206:c::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1664-134.ea.freescale.net (86.124.170.94) by AM0PR06CA0128.eurprd06.prod.outlook.com (2603:10a6:208:ab::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Mon, 2 Nov 2020 03:10:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f522cb59-9174-4b7a-865d-08d87edccf47 X-MS-TrafficTypeDiagnostic: AM6PR04MB5173: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2331; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /GcEIXBW09S42YjoExswiMpBOeJOBu4XnnAKgr92gDeuuHfjTaKfngd1lVagehgnrDnfBHyeTruRoW1pbsoGq/T8BZ2L9Uzgv9+T9xGzuQfXHLnasEcawNjNrbbIDkQkEdW16cUaoPX2Z5w1EoKu88vnN569IGDqgWhQ3ik7LgDX3dMO1PteUPBz3MCmZess8fLzdMTdcR5lwJ9QHP46jsc1pjqH6FUCtHQdrttqqs6muUeaL//LTQf6xkVN/tJGYU4EIMQDywyesaICENZpczxmylg2Ftn0bB3XIwM0FQa6P7TAYfPIVdEcQfFAruyl3xHEvdNQy0JvtTcSXwBvVg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM5PR04MB3137.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(5660300002)(478600001)(86362001)(16526019)(186003)(8936002)(83380400001)(4744005)(6512007)(6666004)(26005)(2906002)(6486002)(316002)(4326008)(66946007)(8676002)(52116002)(956004)(6506007)(1076003)(66476007)(2616005)(7416002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 6G71P/6GqB2np0ct0nXhg3DUkp7pCroqXhMtWG5U59T3K6Ca4cLjQmBjfpMTIjoB2ocnKSjygzThQT4Wt1Aqud1qCQz6B/Srhs7orLvwcQH4KF8xAGyjmjq/ndMRB4jGsVK4mnAvNzqhycCF9aSEBQZlEb0D72x30YBtmiuGVPQQw/AUZCcvIP+GQ5YnbAMVggeDotR25k/tcfMuSgAWojn4iQUyjxb/qEeM7002OCLiwdJK555ayR+daLPLbHReAj5rktyEaWeG58OmpTxBEFybUynBYuqhl3AKEZaL1RgmqgCkI9gKxs2Abzj984sw/yjoIGPnG832IWfkXjtWinkq8Iv9uEazeLfCaCbc+9PmR3TiAMAhKTck4srkS8/dvKs72CbtBj+wIFNEZKdCdRcN50YAmd4XPfNpbTms+Tk+x4DlV5iEvDrBy7zpio7beqlqJsmDo5KH9l3G30T3k+/xWuu1ii7iKFNhKFdFu9jrJvOQs0Xw+ngINKL8cIkQuIr473oGkaUHY+sq6wVkQCxxsJLDFl0mEce3NOuOAZdkDClekGWfqSYOBtoeDSJF7msaHf+3GbSv1+LrlFwivm4fxJkCKzqOHBqh2nOumAH7F7SG/ESwV9LkZf2IenjsdA/PJoJSVcqBHhZBgnOFPQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f522cb59-9174-4b7a-865d-08d87edccf47 X-MS-Exchange-CrossTenant-AuthSource: AM5PR04MB3137.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2020 03:10:11.0969 (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: R2WIIUO7jVvt/t1gi/9d0sB8KoecY6yK209qwj0nflg9n62oUlWOK4L4cEo6vZqn4cHspHDyXlY7Pnwz5q1GiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5173 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mirela Rabulea These are optional in struct v4l2_jpeg_header, so do not parse if not requested, save some time. Signed-off-by: Mirela Rabulea --- drivers/media/v4l2-core/v4l2-jpeg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-jpeg.c b/drivers/media/v4l2-core/v4l2-jpeg.c index 244feccc4ea0..afce12822412 100644 --- a/drivers/media/v4l2-core/v4l2-jpeg.c +++ b/drivers/media/v4l2-core/v4l2-jpeg.c @@ -307,6 +307,9 @@ static int jpeg_parse_quantization_tables(struct jpeg_stream *stream, { int len = jpeg_get_word_be(stream); + if (!tables) + return 0; + if (len < 0) return len; /* Lq = 2 + n * 65 (for baseline DCT), n >= 1 */ @@ -361,6 +364,9 @@ static int jpeg_parse_huffman_tables(struct jpeg_stream *stream, int mt; int len = jpeg_get_word_be(stream); + if (!tables) + return 0; + if (len < 0) return len; /* Table B.5 - Huffman table specification parameter sizes and values */ -- 2.17.1