All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: dafna@fastmail.com, laurent.pinchart@ideasonboard.com,
	linux-media@vger.kernel.org, mchehab@kernel.org, heiko@sntech.de,
	linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 media-next] media: rkisp1: Fix unused value issue
Date: Tue, 19 Nov 2024 11:24:15 +0530	[thread overview]
Message-ID: <ZzwoB4jt9LyTm0x7@HOME-PC> (raw)
In-Reply-To: <3obha26vg2agtmrxjft325ifiwyaftqchgpdgmm7aok7vt7e5c@jfknj6opiudo>

On Mon, Nov 18, 2024 at 11:18:34AM +0100, Jacopo Mondi wrote:
> Hi Dheeraj
> 
> On Mon, Nov 18, 2024 at 03:07:21PM +0530, Dheeraj Reddy Jonnalagadda wrote:
> > This commit fixes an unused value issue detected by Coverity (CID
> > 1519008). If ret is set to an error value in the switch statement, it is
> > not handled before being overwritten later.
> >
> > Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
> 
> Indeed there's something fishy here, however the issue is not very
> much about ret being overritten but rather the error condition
> 
> 	fwnode_graph_for_each_endpoint(fwnode, ep) {
> 		switch (reg) {
> 		case 0:
>         HERE   ---->   (!rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
> 				ret = -EINVAL;
> 				break;
> 			}
> 
> 			break;
> 
> 		case 1:
> 			vep.bus_type = V4L2_MBUS_UNKNOWN;
> 			break;
> 		}
>         }
> 
> breaks the inner switch and not the for loop.
> 
> I would
> 1) Slight reword the commit message to make it about missing an error
> condition
> 2) Add a Fixes tag
>    Fixes: 7d4f126fde89 ("media: rkisp1: Make the internal CSI-2 receiver optional")
>    so that this is collected in the stable trees
> 
> > ---
> >  drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> > index dd114ab77800..9ad5026ab10a 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> > @@ -228,6 +228,9 @@ static int rkisp1_subdev_notifier_register(struct rkisp1_device *rkisp1)
> >  			break;
> >  		}
> >
> > +		if (ret)
> > +			break;
> > +
> 
> The change is correct
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> 
> Thanks
>   j
> 
> >  		/* Parse the endpoint and validate the bus type. */
> >  		ret = v4l2_fwnode_endpoint_parse(ep, &vep);
> >  		if (ret) {
> > --
> > 2.34.1
> >
> >
Hi Jacopo,

Thank you for your feedback. I agree with your suggestion and will update 
the commit message to describe the missing error condition.

-Dheeraj



WARNING: multiple messages have this Message-ID (diff)
From: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: dafna@fastmail.com, laurent.pinchart@ideasonboard.com,
	linux-media@vger.kernel.org, mchehab@kernel.org, heiko@sntech.de,
	linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 media-next] media: rkisp1: Fix unused value issue
Date: Tue, 19 Nov 2024 11:24:15 +0530	[thread overview]
Message-ID: <ZzwoB4jt9LyTm0x7@HOME-PC> (raw)
In-Reply-To: <3obha26vg2agtmrxjft325ifiwyaftqchgpdgmm7aok7vt7e5c@jfknj6opiudo>

On Mon, Nov 18, 2024 at 11:18:34AM +0100, Jacopo Mondi wrote:
> Hi Dheeraj
> 
> On Mon, Nov 18, 2024 at 03:07:21PM +0530, Dheeraj Reddy Jonnalagadda wrote:
> > This commit fixes an unused value issue detected by Coverity (CID
> > 1519008). If ret is set to an error value in the switch statement, it is
> > not handled before being overwritten later.
> >
> > Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
> 
> Indeed there's something fishy here, however the issue is not very
> much about ret being overritten but rather the error condition
> 
> 	fwnode_graph_for_each_endpoint(fwnode, ep) {
> 		switch (reg) {
> 		case 0:
>         HERE   ---->   (!rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
> 				ret = -EINVAL;
> 				break;
> 			}
> 
> 			break;
> 
> 		case 1:
> 			vep.bus_type = V4L2_MBUS_UNKNOWN;
> 			break;
> 		}
>         }
> 
> breaks the inner switch and not the for loop.
> 
> I would
> 1) Slight reword the commit message to make it about missing an error
> condition
> 2) Add a Fixes tag
>    Fixes: 7d4f126fde89 ("media: rkisp1: Make the internal CSI-2 receiver optional")
>    so that this is collected in the stable trees
> 
> > ---
> >  drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> > index dd114ab77800..9ad5026ab10a 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> > @@ -228,6 +228,9 @@ static int rkisp1_subdev_notifier_register(struct rkisp1_device *rkisp1)
> >  			break;
> >  		}
> >
> > +		if (ret)
> > +			break;
> > +
> 
> The change is correct
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> 
> Thanks
>   j
> 
> >  		/* Parse the endpoint and validate the bus type. */
> >  		ret = v4l2_fwnode_endpoint_parse(ep, &vep);
> >  		if (ret) {
> > --
> > 2.34.1
> >
> >
Hi Jacopo,

Thank you for your feedback. I agree with your suggestion and will update 
the commit message to describe the missing error condition.

-Dheeraj


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2024-11-19  5:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18  9:37 [PATCH v2 media-next] media: rkisp1: Fix unused value issue Dheeraj Reddy Jonnalagadda
2024-11-18  9:37 ` Dheeraj Reddy Jonnalagadda
2024-11-18 10:18 ` Jacopo Mondi
2024-11-18 10:18   ` Jacopo Mondi
2024-11-19  5:54   ` Dheeraj Reddy Jonnalagadda [this message]
2024-11-19  5:54     ` Dheeraj Reddy Jonnalagadda
2024-11-18 11:12 ` Laurent Pinchart
2024-11-18 11:12   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZzwoB4jt9LyTm0x7@HOME-PC \
    --to=dheeraj.linuxdev@gmail.com \
    --cc=dafna@fastmail.com \
    --cc=heiko@sntech.de \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.