Message ID | 20231102141135.369-2-adiupina@astralinux.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp382453vqu; Thu, 2 Nov 2023 07:12:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE80eVzOeho4fFQ0bz73K5NrVgCek/EiWkdvQwIYBJxq7FHtllGy8rWDPxMMV9/Mq9LtR0M X-Received: by 2002:a05:6870:13c6:b0:1ea:2c8b:e18b with SMTP id 6-20020a05687013c600b001ea2c8be18bmr18793212oat.35.1698934329972; Thu, 02 Nov 2023 07:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698934329; cv=none; d=google.com; s=arc-20160816; b=GbBA1HeRW0Qoy39jyKwZDrTdT82LodYBf5Ba/pLRyv1SSjDxWBtY2d0ruwkgUdR1de SqXnYay3V4qL+3mf6HYpJcBBGP+sy1FuGG4SkPPLVj5n902L0qlK6qcDGs64tEKtqZPV 9ICfbeRG/Rm/ZXZWTH/THptKoY7pxRpLnTGn5jk7/GBUcahj7aJGVdB/H6xP/1EY7CEw CcHCRKg4NvVtXxaMRMIPMT/8E0/+JoGaEg3cfXmiu9FsYrkHvrwojBSAm8NtM8xQ6+c0 mxRI1kzK3J7qRrdpGxegaY2vx2KQ8OJEdgkAn+lQmSM9RgQNAJE+lSZTY3QB4GhAd8Ce Dmkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NzIUDa6KPLIuUvpKdZyin6WE2LCUY+xnYE5ed3S+G04=; fh=0J6efGmF/A/fDfncUUE/L1ZlTwOK8RkuxnYEmb9gmcI=; b=XzPL0tJ+d4QsVIYB59BhBGM9xT599aB09WbYqd/4FIXr5q5ptseDrc7cG7h9aNvRwy tuGlTGJSeTUP+vYtsdAlhMdnJVSkqsEbNB4pkXQ0jk5hGJxsDOQFAjOi2y84rVAVXYu5 TFtkzafXuq54/tqX4nXyUJHDEd8ODV8DFl5jVJKF3VRrxRj+E5WTEKBlfJCqplVD1T2V eQvdiDP14IZLNbCiO9usFvPLbpmv1OOOFQBGp5sE9mbegULlAu9FGdka2YsfO7lvmqJW PAZmt2zzJGqBrPTICDWNZB5AESYBpnJHbWwiCp/MMBSWXtCK24jm+fy+CFYbMXoU2D/k S70w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a15-20020a65604f000000b005b8ddb9c305si1980553pgp.30.2023.11.02.07.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 07:12:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E3597822D034; Thu, 2 Nov 2023 07:12:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376762AbjKBOMB (ORCPT <rfc822;lhua1029@gmail.com> + 36 others); Thu, 2 Nov 2023 10:12:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbjKBOL6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 2 Nov 2023 10:11:58 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12FA2130; Thu, 2 Nov 2023 07:11:53 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 85B50186AD92; Thu, 2 Nov 2023 17:11:50 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 360raSQFcQ7t; Thu, 2 Nov 2023 17:11:50 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 2C583186AD72; Thu, 2 Nov 2023 17:11:50 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id g0_ELJrllrsB; Thu, 2 Nov 2023 17:11:50 +0300 (MSK) Received: from rbta-msk-lt-302690.astralinux.ru (unknown [10.177.237.131]) by mail.astralinux.ru (Postfix) with ESMTPSA id 42ED2186AD74; Thu, 2 Nov 2023 17:11:47 +0300 (MSK) From: Alexandra Diupina <adiupina@astralinux.ru> To: Jacopo Mondi <jacopo+renesas@jmondi.org> Cc: Alexandra Diupina <adiupina@astralinux.ru>, Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>, Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>, =?utf-8?q?Nik?= =?utf-8?q?las_S=C3=B6derlund?= <niklas.soderlund+renesas@ragnatech.se>, Mauro Carvalho Chehab <mchehab@kernel.org>, Hans de Goede <hdegoede@redhat.com>, Sakari Ailus <sakari.ailus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Andy Shevchenko <andy@kernel.org>, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Rob Herring <robh@kernel.org>, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, lvc-project@linuxtesting.org Subject: [PATCH 2/4] Remove redundant return value check Date: Thu, 2 Nov 2023 17:11:33 +0300 Message-Id: <20231102141135.369-2-adiupina@astralinux.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231102141135.369-1-adiupina@astralinux.ru> References: <20231102141135.369-1-adiupina@astralinux.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 02 Nov 2023 07:12:04 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781461764372167446 X-GMAIL-MSGID: 1781461764372167446 |
Series |
[1/4] Remove redundant return value check
|
|
Commit Message
Alexandra Diupina
Nov. 2, 2023, 2:11 p.m. UTC
media_entity_pads_init() will not return 0 only if the
2nd parameter >= MEDIA_ENTITY_MAX_PADS (512), but 1 is
passed, so checking the return value is redundant
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 34009bffc1c6 ("media: i2c: Add RDACM20 driver")
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
---
drivers/media/i2c/rdacm20.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Comments
Hi Alexandra On Thu, Nov 02, 2023 at 05:11:33PM +0300, Alexandra Diupina wrote: > media_entity_pads_init() will not return 0 only if the > 2nd parameter >= MEDIA_ENTITY_MAX_PADS (512), but 1 is > passed, so checking the return value is redundant I do also see if (hweight32(iter->flags & (MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_SOURCE)) != 1) { ret = -EINVAL; break; } as a possible failure in in media_entity_pads_init(). > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: 34009bffc1c6 ("media: i2c: Add RDACM20 driver") And this does not really qualify as a fix imho In general, being defensive and check for return errors in not a bad thing. I would keep the check in place, it really doesn't hurt. Same for the other patches in the series. Thanks j > Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru> > --- > drivers/media/i2c/rdacm20.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c > index f4e2e2f3972a..ed249ade54e0 100644 > --- a/drivers/media/i2c/rdacm20.c > +++ b/drivers/media/i2c/rdacm20.c > @@ -611,9 +611,7 @@ static int rdacm20_probe(struct i2c_client *client) > > dev->pad.flags = MEDIA_PAD_FL_SOURCE; > dev->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; > - ret = media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); > - if (ret < 0) > - goto error_free_ctrls; > + media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); > > ret = v4l2_async_register_subdev(&dev->sd); > if (ret) > -- > 2.30.2 >
On Thu, Nov 02, 2023 at 05:11:33PM +0300, Alexandra Diupina wrote: > media_entity_pads_init() will not return 0 only if the > 2nd parameter >= MEDIA_ENTITY_MAX_PADS (512), but 1 is > passed, so checking the return value is redundant That may be the case today, but may not be true tomorrow if the function is extended to perform extra checks. I don't think dropping the error check in drivers is a good idea. > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: 34009bffc1c6 ("media: i2c: Add RDACM20 driver") > Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru> > --- > drivers/media/i2c/rdacm20.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c > index f4e2e2f3972a..ed249ade54e0 100644 > --- a/drivers/media/i2c/rdacm20.c > +++ b/drivers/media/i2c/rdacm20.c > @@ -611,9 +611,7 @@ static int rdacm20_probe(struct i2c_client *client) > > dev->pad.flags = MEDIA_PAD_FL_SOURCE; > dev->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; > - ret = media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); > - if (ret < 0) > - goto error_free_ctrls; > + media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); > > ret = v4l2_async_register_subdev(&dev->sd); > if (ret)
diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c index f4e2e2f3972a..ed249ade54e0 100644 --- a/drivers/media/i2c/rdacm20.c +++ b/drivers/media/i2c/rdacm20.c @@ -611,9 +611,7 @@ static int rdacm20_probe(struct i2c_client *client) dev->pad.flags = MEDIA_PAD_FL_SOURCE; dev->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; - ret = media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); - if (ret < 0) - goto error_free_ctrls; + media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); ret = v4l2_async_register_subdev(&dev->sd); if (ret)