2021-07-22 22:54:42

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: Fixes tag needs some work in the v4l-dvb-next tree

Hi all,

In commit

c275e5d349b0 ("media: atomisp: fix the uninitialized use and rename "retvalue"")

Fixes tag

Fixes: ad85094 (media / atomisp: fix the uninitialized use of model ID)

has these problem(s):

- SHA1 should be at least 12 digits long
Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11
or later) just making sure it is not set (or set to "auto").
- Subject does not match target commit subject
Just use
git log -1 --format='Fixes: %h ("%s")'

maybe you meant

Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2021-07-23 00:36:46

by Yizhuo Zhai

[permalink] [raw]
Subject: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

Inside function mt9m114_detect(), variable "retvalue" could
be uninitialized if mt9m114_read_reg() returns error, however, it
is used in the later if statement, which is potentially unsafe.

The local variable "retvalue" is renamed to "model" to avoid
confusion.

Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
Signed-off-by: Yizhuo <[email protected]>
---
drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
index f5de81132177..77293579a134 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
@@ -1533,16 +1533,19 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
static int mt9m114_detect(struct mt9m114_device *dev, struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
- u32 retvalue;
+ u32 model;
+ int ret;

if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev, "%s: i2c error", __func__);
return -ENODEV;
}
- mt9m114_read_reg(client, MISENSOR_16BIT, (u32)MT9M114_PID, &retvalue);
- dev->real_model_id = retvalue;
+ ret = mt9m114_read_reg(client, MISENSOR_16BIT, MT9M114_PID, &model);
+ if (ret)
+ return ret;
+ dev->real_model_id = model;

- if (retvalue != MT9M114_MOD_ID) {
+ if (model != MT9M114_MOD_ID) {
dev_err(&client->dev, "%s: failed: client->addr = %x\n",
__func__, client->addr);
return -ENODEV;
--
2.17.1

2021-07-23 00:39:51

by Yizhuo Zhai

[permalink] [raw]
Subject: Re: linux-next: Fixes tag needs some work in the v4l-dvb-next tree

All:
I've fixed this issue and resend the patch to the maintainers. I'm so
sorry for the inconvenience.
Stephen:
It seems you are not in the maintainers' mailing list, should I send a
copy to you as well?


On Thu, Jul 22, 2021 at 3:51 PM Stephen Rothwell <[email protected]> wrote:
>
> Hi all,
>
> In commit
>
> c275e5d349b0 ("media: atomisp: fix the uninitialized use and rename "retvalue"")
>
> Fixes tag
>
> Fixes: ad85094 (media / atomisp: fix the uninitialized use of model ID)
>
> has these problem(s):
>
> - SHA1 should be at least 12 digits long
> Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11
> or later) just making sure it is not set (or set to "auto").
> - Subject does not match target commit subject
> Just use
> git log -1 --format='Fixes: %h ("%s")'
>
> maybe you meant
>
> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
>
> --
> Cheers,
> Stephen Rothwell



--
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

2021-07-23 01:02:23

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: Fixes tag needs some work in the v4l-dvb-next tree

Hi Yizhuo,

On Thu, 22 Jul 2021 17:38:13 -0700 Yizhuo Zhai <[email protected]> wrote:
>
> Stephen:
> It seems you are not in the maintainers' mailing list, should I send a
> copy to you as well?

No, that's fine, I will get the fix via the maintainer.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2021-07-23 02:22:47

by Yizhuo Zhai

[permalink] [raw]
Subject: Re: linux-next: Fixes tag needs some work in the v4l-dvb-next tree

Stephen:
Great, thanks.

On Thu, Jul 22, 2021 at 5:58 PM Stephen Rothwell <[email protected]> wrote:
>
> Hi Yizhuo,
>
> On Thu, 22 Jul 2021 17:38:13 -0700 Yizhuo Zhai <[email protected]> wrote:
> >
> > Stephen:
> > It seems you are not in the maintainers' mailing list, should I send a
> > copy to you as well?
>
> No, that's fine, I will get the fix via the maintainer.
>
> --
> Cheers,
> Stephen Rothwell



--
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

2021-07-23 07:07:08

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: linux-next: Fixes tag needs some work in the v4l-dvb-next tree

Em Thu, 22 Jul 2021 17:38:13 -0700
Yizhuo Zhai <[email protected]> escreveu:

> All:
> I've fixed this issue and resend the patch to the maintainers. I'm so
> sorry for the inconvenience.
> Stephen:
> It seems you are not in the maintainers' mailing list, should I send a
> copy to you as well?
>
>
> On Thu, Jul 22, 2021 at 3:51 PM Stephen Rothwell <[email protected]> wrote:
> >
> > Hi all,
> >
> > In commit
> >
> > c275e5d349b0 ("media: atomisp: fix the uninitialized use and rename "retvalue"")
> >
> > Fixes tag
> >
> > Fixes: ad85094 (media / atomisp: fix the uninitialized use of model ID)
> >
> > has these problem(s):
> >
> > - SHA1 should be at least 12 digits long
> > Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11
> > or later) just making sure it is not set (or set to "auto").
> > - Subject does not match target commit subject
> > Just use
> > git log -1 --format='Fixes: %h ("%s")'
> >
> > maybe you meant
> >
> > Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")

Fixes tag updated.

Regards,
Mauro

2021-07-23 08:13:10

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

On Fri, Jul 23, 2021 at 12:36:04AM +0000, Yizhuo wrote:
> Inside function mt9m114_detect(), variable "retvalue" could
> be uninitialized if mt9m114_read_reg() returns error, however, it
> is used in the later if statement, which is potentially unsafe.
>
> The local variable "retvalue" is renamed to "model" to avoid
> confusion.
>
> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
> Signed-off-by: Yizhuo <[email protected]>
> ---

Is your full name just Yizhuo or Yizhuo Zhai? Please use your legal
name as if you were signing a legal document.

I don't think you have changed anything in this version? It's basically
a resend of the patch from Jun 25? Please put that information under
the --- cut off.

Looks okay to me.

Reviewed-by: Dan Carpenter <[email protected]>

regards,
dan carpenter

2021-07-23 09:20:57

by Yizhuo Zhai

[permalink] [raw]
Subject: Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

Hi Dan:
I updated the fix tag in this version, I would sign the patch using my
full name, thanks.

On Fri, Jul 23, 2021 at 1:11 AM Dan Carpenter <[email protected]> wrote:
>
> On Fri, Jul 23, 2021 at 12:36:04AM +0000, Yizhuo wrote:
> > Inside function mt9m114_detect(), variable "retvalue" could
> > be uninitialized if mt9m114_read_reg() returns error, however, it
> > is used in the later if statement, which is potentially unsafe.
> >
> > The local variable "retvalue" is renamed to "model" to avoid
> > confusion.
> >
> > Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
> > Signed-off-by: Yizhuo <[email protected]>
> > ---
>
> Is your full name just Yizhuo or Yizhuo Zhai? Please use your legal
> name as if you were signing a legal document.
>
> I don't think you have changed anything in this version? It's basically
> a resend of the patch from Jun 25? Please put that information under
> the --- cut off.
>
> Looks okay to me.
>
> Reviewed-by: Dan Carpenter <[email protected]>
>
> regards,
> dan carpenter
>


--
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

2021-08-11 03:55:58

by Yizhuo Zhai

[permalink] [raw]
Subject: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

From: Yizhuo <[email protected]>

Inside function mt9m114_detect(), variable "retvalue" could
be uninitialized if mt9m114_read_reg() returns error, however, it
is used in the later if statement, which is potentially unsafe.

The local variable "retvalue" is renamed to "model" to avoid
confusion.

Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
Signed-off-by: Yizhuo Zhai<[email protected]>
---
drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
index f5de81132177..77293579a134 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
@@ -1533,16 +1533,19 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
static int mt9m114_detect(struct mt9m114_device *dev, struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
- u32 retvalue;
+ u32 model;
+ int ret;

if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev, "%s: i2c error", __func__);
return -ENODEV;
}
- mt9m114_read_reg(client, MISENSOR_16BIT, (u32)MT9M114_PID, &retvalue);
- dev->real_model_id = retvalue;
+ ret = mt9m114_read_reg(client, MISENSOR_16BIT, MT9M114_PID, &model);
+ if (ret)
+ return ret;
+ dev->real_model_id = model;

- if (retvalue != MT9M114_MOD_ID) {
+ if (model != MT9M114_MOD_ID) {
dev_err(&client->dev, "%s: failed: client->addr = %x\n",
__func__, client->addr);
return -ENODEV;
--
2.17.1

2021-08-11 04:22:04

by Yizhuo Zhai

[permalink] [raw]
Subject: Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

Hi All:
For your information, I update my signed-off zone using my full name
"Yizhuo Zhai"

On Tue, Aug 10, 2021 at 8:54 PM Yizhuo Zhai <[email protected]> wrote:
>
> From: Yizhuo <[email protected]>
>
> Inside function mt9m114_detect(), variable "retvalue" could
> be uninitialized if mt9m114_read_reg() returns error, however, it
> is used in the later if statement, which is potentially unsafe.
>
> The local variable "retvalue" is renamed to "model" to avoid
> confusion.
>
> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
> Signed-off-by: Yizhuo Zhai<[email protected]>
> ---
> drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> index f5de81132177..77293579a134 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> @@ -1533,16 +1533,19 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
> static int mt9m114_detect(struct mt9m114_device *dev, struct i2c_client *client)
> {
> struct i2c_adapter *adapter = client->adapter;
> - u32 retvalue;
> + u32 model;
> + int ret;
>
> if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
> dev_err(&client->dev, "%s: i2c error", __func__);
> return -ENODEV;
> }
> - mt9m114_read_reg(client, MISENSOR_16BIT, (u32)MT9M114_PID, &retvalue);
> - dev->real_model_id = retvalue;
> + ret = mt9m114_read_reg(client, MISENSOR_16BIT, MT9M114_PID, &model);
> + if (ret)
> + return ret;
> + dev->real_model_id = model;
>
> - if (retvalue != MT9M114_MOD_ID) {
> + if (model != MT9M114_MOD_ID) {
> dev_err(&client->dev, "%s: failed: client->addr = %x\n",
> __func__, client->addr);
> return -ENODEV;
> --
> 2.17.1
>


--
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

2021-08-11 07:03:13

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

On Tue, Aug 10, 2021 at 08:54:03PM -0700, Yizhuo Zhai wrote:
> From: Yizhuo <[email protected]>

This name is not matching the name you use in your signed-off-by line :(

2021-08-12 05:53:14

by Yizhuo Zhai

[permalink] [raw]
Subject: Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

Greg:
Sorry for the inconvenience, let me fix this issue and send a new one, thanks.

On Wed, Aug 11, 2021 at 12:01 AM Greg Kroah-Hartman
<[email protected]> wrote:
>
> On Tue, Aug 10, 2021 at 08:54:03PM -0700, Yizhuo Zhai wrote:
> > From: Yizhuo <[email protected]>
>
> This name is not matching the name you use in your signed-off-by line :(



--
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

2021-08-12 05:58:00

by Yizhuo Zhai

[permalink] [raw]
Subject: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

Inside function mt9m114_detect(), variable "retvalue" could
be uninitialized if mt9m114_read_reg() returns error, however, it
is used in the later if statement, which is potentially unsafe.

The local variable "retvalue" is renamed to "model" to avoid
confusion.

Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
Signed-off-by: Yizhuo Zhai<[email protected]>
---
drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
index f5de81132177..77293579a134 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
@@ -1533,16 +1533,19 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
static int mt9m114_detect(struct mt9m114_device *dev, struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
- u32 retvalue;
+ u32 model;
+ int ret;

if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev, "%s: i2c error", __func__);
return -ENODEV;
}
- mt9m114_read_reg(client, MISENSOR_16BIT, (u32)MT9M114_PID, &retvalue);
- dev->real_model_id = retvalue;
+ ret = mt9m114_read_reg(client, MISENSOR_16BIT, MT9M114_PID, &model);
+ if (ret)
+ return ret;
+ dev->real_model_id = model;

- if (retvalue != MT9M114_MOD_ID) {
+ if (model != MT9M114_MOD_ID) {
dev_err(&client->dev, "%s: failed: client->addr = %x\n",
__func__, client->addr);
return -ENODEV;
--
2.25.1

2021-08-12 06:58:13

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

On Wed, Aug 11, 2021 at 10:54:17PM -0700, Yizhuo Zhai wrote:
> Inside function mt9m114_detect(), variable "retvalue" could
> be uninitialized if mt9m114_read_reg() returns error, however, it
> is used in the later if statement, which is potentially unsafe.
>
> The local variable "retvalue" is renamed to "model" to avoid
> confusion.
>
> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
> Signed-off-by: Yizhuo Zhai<[email protected]>
> ---
> drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> index f5de81132177..77293579a134 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> @@ -1533,16 +1533,19 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
> static int mt9m114_detect(struct mt9m114_device *dev, struct i2c_client *client)
> {
> struct i2c_adapter *adapter = client->adapter;
> - u32 retvalue;
> + u32 model;
> + int ret;
>
> if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
> dev_err(&client->dev, "%s: i2c error", __func__);
> return -ENODEV;
> }
> - mt9m114_read_reg(client, MISENSOR_16BIT, (u32)MT9M114_PID, &retvalue);
> - dev->real_model_id = retvalue;
> + ret = mt9m114_read_reg(client, MISENSOR_16BIT, MT9M114_PID, &model);
> + if (ret)
> + return ret;
> + dev->real_model_id = model;
>
> - if (retvalue != MT9M114_MOD_ID) {
> + if (model != MT9M114_MOD_ID) {
> dev_err(&client->dev, "%s: failed: client->addr = %x\n",
> __func__, client->addr);
> return -ENODEV;
> --
> 2.25.1
>
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/SubmittingPatches for what needs to be done
here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

2021-08-12 06:58:42

by Sakari Ailus

[permalink] [raw]
Subject: Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

On Wed, Aug 11, 2021 at 10:54:17PM -0700, Yizhuo Zhai wrote:
> Inside function mt9m114_detect(), variable "retvalue" could
> be uninitialized if mt9m114_read_reg() returns error, however, it
> is used in the later if statement, which is potentially unsafe.
>
> The local variable "retvalue" is renamed to "model" to avoid
> confusion.
>
> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
> Signed-off-by: Yizhuo Zhai<[email protected]>

There should be a space before '<'.

Apart from this the patch seems fine.

> ---
> drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> index f5de81132177..77293579a134 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> @@ -1533,16 +1533,19 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
> static int mt9m114_detect(struct mt9m114_device *dev, struct i2c_client *client)
> {
> struct i2c_adapter *adapter = client->adapter;
> - u32 retvalue;
> + u32 model;
> + int ret;
>
> if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
> dev_err(&client->dev, "%s: i2c error", __func__);
> return -ENODEV;
> }
> - mt9m114_read_reg(client, MISENSOR_16BIT, (u32)MT9M114_PID, &retvalue);
> - dev->real_model_id = retvalue;
> + ret = mt9m114_read_reg(client, MISENSOR_16BIT, MT9M114_PID, &model);
> + if (ret)
> + return ret;
> + dev->real_model_id = model;
>
> - if (retvalue != MT9M114_MOD_ID) {
> + if (model != MT9M114_MOD_ID) {
> dev_err(&client->dev, "%s: failed: client->addr = %x\n",
> __func__, client->addr);
> return -ENODEV;

--
Regards,

Sakari Ailus

2021-08-12 07:45:53

by Yizhuo Zhai

[permalink] [raw]
Subject: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

Inside function mt9m114_detect(), variable "retvalue" could
be uninitialized if mt9m114_read_reg() returns error, however, it
is used in the later if statement, which is potentially unsafe.

The local variable "retvalue" is renamed to "model" to avoid
confusion.

Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
Signed-off-by: Yizhuo Zhai <[email protected]>
---
drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
index f5de81132177..77293579a134 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
@@ -1533,16 +1533,19 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
static int mt9m114_detect(struct mt9m114_device *dev, struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
- u32 retvalue;
+ u32 model;
+ int ret;

if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev, "%s: i2c error", __func__);
return -ENODEV;
}
- mt9m114_read_reg(client, MISENSOR_16BIT, (u32)MT9M114_PID, &retvalue);
- dev->real_model_id = retvalue;
+ ret = mt9m114_read_reg(client, MISENSOR_16BIT, MT9M114_PID, &model);
+ if (ret)
+ return ret;
+ dev->real_model_id = model;

- if (retvalue != MT9M114_MOD_ID) {
+ if (model != MT9M114_MOD_ID) {
dev_err(&client->dev, "%s: failed: client->addr = %x\n",
__func__, client->addr);
return -ENODEV;
--
2.25.1

2021-08-12 07:51:10

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"

On Thu, Aug 12, 2021 at 12:34:46AM -0700, Yizhuo Zhai wrote:
> Inside function mt9m114_detect(), variable "retvalue" could
> be uninitialized if mt9m114_read_reg() returns error, however, it
> is used in the later if statement, which is potentially unsafe.
>
> The local variable "retvalue" is renamed to "model" to avoid
> confusion.
>
> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
> Signed-off-by: Yizhuo Zhai <[email protected]>
> ---
> drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> index f5de81132177..77293579a134 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> @@ -1533,16 +1533,19 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
> static int mt9m114_detect(struct mt9m114_device *dev, struct i2c_client *client)
> {
> struct i2c_adapter *adapter = client->adapter;
> - u32 retvalue;
> + u32 model;
> + int ret;
>
> if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
> dev_err(&client->dev, "%s: i2c error", __func__);
> return -ENODEV;
> }
> - mt9m114_read_reg(client, MISENSOR_16BIT, (u32)MT9M114_PID, &retvalue);
> - dev->real_model_id = retvalue;
> + ret = mt9m114_read_reg(client, MISENSOR_16BIT, MT9M114_PID, &model);
> + if (ret)
> + return ret;
> + dev->real_model_id = model;
>
> - if (retvalue != MT9M114_MOD_ID) {
> + if (model != MT9M114_MOD_ID) {
> dev_err(&client->dev, "%s: failed: client->addr = %x\n",
> __func__, client->addr);
> return -ENODEV;
> --
> 2.25.1
>
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/SubmittingPatches for what needs to be done
here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot