From patchwork Tue Jul 18 09:50:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13318277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82C93EB64DA for ; Wed, 19 Jul 2023 06:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5oTQQlHrR1Lmsm0XC3rIEhzfmD+pvuzs4wFYY1P6q98=; b=uiVKdTjI6SuQ1f YaeD4ARteQ5vC/HlhNB1rnQL21amH/VJg4F+9x5S+Rh+JO2QBk+A32k3UT2ZlgtFbk5vFL0YG8uSe boE2U0DfHJrMkfN+sDiiGetK1RoCWeb/22vpr1Asq6u4ph2Oi/PArUT/IIDMKA6jrdeLAVyNkBzQe yjIfj5JXQDgk2bjLOyXOv1ra2XeZUzW0woOqVjv0hCxeyjRTN5Wc80MYUuoONIm1FJqevwVPofmg0 eqz2QZqISxG+8/d/7S9TKlPWZlOFXCfhPNIvkabwkbmstg+rcwXO+zoxTbci0m05peAzjHOmPJKjM lZBn523U3oZBOFui2uyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qM0Hn-005Wyi-0r; Wed, 19 Jul 2023 06:03:43 +0000 Received: from desiato.infradead.org ([90.155.92.199]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qM0Hl-005WyG-2e for linux-arm-kernel@bombadil.infradead.org; Wed, 19 Jul 2023 06:03:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=XMPSaVrTk90sPU+BiEdPKlljJs+HqKRNWWBHYcWnATM=; b=cf+hRujoza6bET97n3xHuFvJsj VhybjGBKy++lxrPwonHPMSqeoixQFSzPlvxmnIpBeTXQrjV4ItL3c7BLURA0/Gj0pw51M6+18SLoS Co3ZAhCNvbPfCAEKP25rjfAaMIdQ6arLvWi4Z+gGE5CdqPYgFvWD8S5Ud1n/WAiraMC1BEzD+0bf6 xmjCNq2D1nditxke/QInJ2Q5oZfVfbK8Lovja6E1bxaYMbgQEGEmQnYVonm64Mx5tm1GH/omg9Axc ervlNCYi1SmByO7u4nI7aeof0B3nMmg+JGoeLCGhnPKIMmQnVpBWZNLtxActKQO04iMB8DcdvxYPx JQQxFGHg==; Received: from mail-ve1eur01on0631.outbound.protection.outlook.com ([2a01:111:f400:fe1f::631] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qLhaq-00BOjP-0V for linux-arm-kernel@lists.infradead.org; Tue, 18 Jul 2023 10:06:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f4txJXoxhh/9Ppywwse6QlGvgwj5xnCdG0J9eRpTm+agbr3ARbqn+NGeod/M9DZu90MNJlEntRkyQWlzrUl3QVMXIsNEkmiYEq3dgG4+ZVVRh2WGB3+ZC7v9SqpM+fwBD7NAGa6lMMPQYjazcMfLR3I8Kw5Dk304vvpwdasQdPLuic59xCKM5Lti/OYDyRNc1xVvIfe22J2qP+HxKK8OxjBwtFlYGJ5UcffnfuM29k68f2KeA+CUQsdMvZqHQtcdFvZj5TIyR4FMdi5YgrWDc4AmasF5ypCz4MvzFga5MJOhnpo0cuPpfsAmL64g2k3zjMPlLlZuHKS37yUPqaM6Dg== 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=XMPSaVrTk90sPU+BiEdPKlljJs+HqKRNWWBHYcWnATM=; b=EGdLcyF5Xf8oNB/mgvbIvH2x9UPypSqyLFsm2OYW2/EmSTdPZZmqC2pw9Fe5JdRNPn+P7r4mG1pSW1Iu+nJg+xMcqFbj1k+ohcvMiDq/R8oQ3dBfZCnrJJz6Unqj68e1xpPPhJ38ZAoKiyWhEmMtVvCvYpovO/ceb5epKmnUvajDumJrjStdoRRWa9dWJ/iGqOfkDckmSjc56c2QVCzM6DyimnL9S5Ud1jK3yowEFZfobVF5P9567U6DsKmEvBbooYko3OVTv9YNMTiwf1fkoWGGvJbKqrEs9jAwelBRbqH5LlM4dYV4Tl4WfHGV7zt+PjXIe9LsQgKz7f9DDl70kg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XMPSaVrTk90sPU+BiEdPKlljJs+HqKRNWWBHYcWnATM=; b=XNBExj3bcW0mHsYELRQi45CF6+5RL9WKqUt+wFtlQzxRiSOq+Tgh5Lelzo8pFzM3Rq3niKGCMmfv5+tbAwK6NUlUyQiihDhM3lm0dzCFiBZuOqb7uBiVKboGE5TIj3uGmXZmO06jqtrbqDkt+DGoaCfApxGO82rV/aljf4+Ncok= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by DB8PR04MB7067.eurprd04.prod.outlook.com (2603:10a6:10:12a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Tue, 18 Jul 2023 09:50:51 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::613b:e94b:4ccd:f55a%5]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 09:50:50 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/5] media: amphion: fix REVERSE_INULL issues reported by coverity Date: Tue, 18 Jul 2023 17:50:10 +0800 Message-Id: <4dc65b83d866d91062e52d7caca88663f4934a56.1689673395.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:4:197::8) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB8PR04MB7067:EE_ X-MS-Office365-Filtering-Correlation-Id: 66445956-5991-4de0-aa76-08db87747840 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4ej7Q5wPSnEvqtHdbnnEf7/ifZbkOSR+6nNHgzf3jR03rNQXQq3mLAWouuzQCE8Yb3NdsdvWwKSAtyRXSUkUvqDab0t5JUdbgk8ILsIfhCUU9l341Zr5aX3Tuoa5CHL49QUa6BU8MA64r00pFvO3pEHwi7EN1ykvO/Q6TSqEXEt3kBNKl9t9YDwbw/bqRhwgDonW300ErtZQ+/EPSzagPNgNlZ8HpmiDeQi1U/pgbMYbJOTXUyTIDthfjjwa/6YyPyYGw5vE0siHSO/0U7RGg9yrUHaBgy+mQct60qXgB9n59dEpZp4A7L1uKXogEsFGDtrQZJ4MNK7QYno7pOancRoPsnTHmzdmgGqN/xVOJbwrxSUccSembYik+WBiEAvG1awOb3kAnVpxv04dbV/UOtdnLq/TcMNgQDHqNfhJUgTEz9T6iwsWf7RJ2TSP5bbVGKMixP8QWTkkafDvsqB/WHOBg6DZJ9lV0wxJerBXub1okgCcNEHciDBg0PuT4p0Mw4cySVEZ9n7ZMVqtHPTraltd207Wqv7mEhrzTlisufCAU8HwZShTvPkioSCStLedBZfzl9eNB8VbHkTVNO/xnUzY8G8vP1KCcV8jwbXEUGZD507+yg+eSyu7jx2Pe5A1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(376002)(39860400002)(136003)(346002)(396003)(451199021)(7416002)(86362001)(2906002)(36756003)(44832011)(2616005)(6512007)(83380400001)(186003)(6506007)(26005)(38350700002)(38100700002)(52116002)(6486002)(6666004)(4326008)(66946007)(66476007)(66556008)(316002)(5660300002)(478600001)(8676002)(41300700001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-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w9/HTGdTL7jQOfXufturKwwI0tTL8RrDHaz1yzkRKTY517Yz9JnuP/txhC25AQnW4m3VCE6PGqDqD8iVJrHrnWk1KSYCuj+8rKeNfd7YPVMVH8hQZfi7o5so8OCc+8OcdO3KFmBEe/D5SsLCYhESp43RS3iM87oF3udb9kKp+2SQ/KrZv6hYPabZJmadWtF7nYMIcg6IUCoUbqgoX1IYSULkHaPk3hMuWpQ6sxVnyAc3tfrXR6PCwktH+r0nOhbXicqeO0MQOBnSXNULuKWFuZXoerQr8gFUSa3UJBiFJxysvJWZvC2FtUp+F6EVv3oBeDcssI9T898CjzB/UDz9V7W1NLXw0o4hR2xgGSVw5HwGpGE7T3LhvERrQsYvvP/F7oTfnQKSJ2rHTjwGgLwTHKb3+skWd0UDGG5gPkuXsLpd1qczQqOTTA5qFHPFrXI9Jx+HoDC8f9GJtXb7ryg4UDUYLYwHT9SE15/VzGedSf6lC3I8V/H6/E0XPNG+a7DNFu0dCfZaM/ko55Dvb2mlkcm69IJpOFc4MgLGZ5gD2Aqlm041s1iiAO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66445956-5991-4de0-aa76-08db87747840 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 09:50:50.8331 (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: d5VpRAqJDFxzrMGH0YKsDklJb/5STbgJ4p08R3OjXE9lWYA9rc5F74e7pvwKGMDmbPLnpFYk2GYQiJcbHqB6Dw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7067 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230718_110608_452222_9B0E61A0 X-CRM114-Status: GOOD ( 11.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org null-checking of a pointor is suggested before dereferencing it Fixes: 9f599f351e86 ("media: amphion: add vpu core driver") Reviewed-by: Nicolas Dufresne Signed-off-by: Ming Qian --- drivers/media/platform/amphion/venc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c index 58480e2755ec..4eb57d793a9c 100644 --- a/drivers/media/platform/amphion/venc.c +++ b/drivers/media/platform/amphion/venc.c @@ -268,7 +268,7 @@ static int venc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm { struct vpu_inst *inst = to_inst(file); struct venc_t *venc = inst->priv; - struct v4l2_fract *timeperframe = &parm->parm.capture.timeperframe; + struct v4l2_fract *timeperframe; if (!parm) return -EINVAL; @@ -279,6 +279,7 @@ static int venc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm if (!vpu_helper_check_type(inst, parm->type)) return -EINVAL; + timeperframe = &parm->parm.capture.timeperframe; parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; parm->parm.capture.readbuffers = 0; timeperframe->numerator = venc->params.frame_rate.numerator; @@ -291,7 +292,7 @@ static int venc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *parm { struct vpu_inst *inst = to_inst(file); struct venc_t *venc = inst->priv; - struct v4l2_fract *timeperframe = &parm->parm.capture.timeperframe; + struct v4l2_fract *timeperframe; unsigned long n, d; if (!parm) @@ -303,6 +304,7 @@ static int venc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *parm if (!vpu_helper_check_type(inst, parm->type)) return -EINVAL; + timeperframe = &parm->parm.capture.timeperframe; if (!timeperframe->numerator) timeperframe->numerator = venc->params.frame_rate.numerator; if (!timeperframe->denominator)