Linux Media Controller development
 help / color / mirror / Atom feed
* [bug report] media: ov2740: allow OTP data access during streaming
@ 2020-12-02 14:48 Dan Carpenter
  2020-12-03  2:49 ` Cao, Bingbu
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-12-02 14:48 UTC (permalink / raw)
  To: bingbu.cao; +Cc: linux-media

Hello Bingbu Cao,

This is a semi-automatic email about new static checker warnings.

The patch 5e6fd339b68d: "media: ov2740: allow OTP data access during 
streaming" from Nov 13, 2020, leads to the following Smatch complaint:

    drivers/media/i2c/ov2740.c:609 ov2740_load_otp_data()
    warn: variable dereferenced before check 'nvm' (see line 603)

drivers/media/i2c/ov2740.c
   601  static int ov2740_load_otp_data(struct nvm_data *nvm)
   602	{
   603		struct i2c_client *client = nvm->client;
                                            ^^^^^^^^^^^
Dereference

   604		struct ov2740 *ov2740 = to_ov2740(i2c_get_clientdata(client));
   605		u32 isp_ctrl00 = 0;
   606		u32 isp_ctrl01 = 0;
   607		int ret;
   608	
   609		if (!nvm)
                    ^^^^
Checked too late.

   610			return -EINVAL;
   611	

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [bug report] media: ov2740: allow OTP data access during streaming
  2020-12-02 14:48 [bug report] media: ov2740: allow OTP data access during streaming Dan Carpenter
@ 2020-12-03  2:49 ` Cao, Bingbu
  0 siblings, 0 replies; 2+ messages in thread
From: Cao, Bingbu @ 2020-12-03  2:49 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: linux-media@vger.kernel.org, Cao, Bingbu, Bingbu Cao,
	colin.king@canonical.com

Hi, Dan

Thanks for your report.

There is a patch from Colin King which is addressing this issue.
media: ov2740: fix dereference before null check on pointer nvm

Thank you!

________________________
BRs,  
Bingbu Cao 

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Sent: Wednesday, December 2, 2020 10:48 PM
> To: Cao, Bingbu <bingbu.cao@intel.com>
> Cc: linux-media@vger.kernel.org
> Subject: [bug report] media: ov2740: allow OTP data access during
> streaming
> 
> Hello Bingbu Cao,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 5e6fd339b68d: "media: ov2740: allow OTP data access during
> streaming" from Nov 13, 2020, leads to the following Smatch complaint:
> 
>     drivers/media/i2c/ov2740.c:609 ov2740_load_otp_data()
>     warn: variable dereferenced before check 'nvm' (see line 603)
> 
> drivers/media/i2c/ov2740.c
>    601  static int ov2740_load_otp_data(struct nvm_data *nvm)
>    602	{
>    603		struct i2c_client *client = nvm->client;
>                                             ^^^^^^^^^^^ Dereference
> 
>    604		struct ov2740 *ov2740 =
> to_ov2740(i2c_get_clientdata(client));
>    605		u32 isp_ctrl00 = 0;
>    606		u32 isp_ctrl01 = 0;
>    607		int ret;
>    608
>    609		if (!nvm)
>                     ^^^^
> Checked too late.
> 
>    610			return -EINVAL;
>    611
> 
> regards,
> dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-03  2:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-02 14:48 [bug report] media: ov2740: allow OTP data access during streaming Dan Carpenter
2020-12-03  2:49 ` Cao, Bingbu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox