LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* linux-next: Fixes tag needs some work in the v4l-dvb-next tree
@ 2021-07-22 22:51 Stephen Rothwell
2021-07-23 0:36 ` [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue" Yizhuo
2021-07-23 0:38 ` linux-next: Fixes tag needs some work in the v4l-dvb-next tree Yizhuo Zhai
0 siblings, 2 replies; 17+ messages in thread
From: Stephen Rothwell @ 2021-07-22 22:51 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Yizhuo, Linux Kernel Mailing List, Linux Next Mailing List
[-- Attachment #1: Type: text/plain, Size: 643 bytes --]
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-07-22 22:51 linux-next: Fixes tag needs some work in the v4l-dvb-next tree Stephen Rothwell
@ 2021-07-23 0:36 ` Yizhuo
2021-07-23 8:10 ` Dan Carpenter
` (3 more replies)
2021-07-23 0:38 ` linux-next: Fixes tag needs some work in the v4l-dvb-next tree Yizhuo Zhai
1 sibling, 4 replies; 17+ messages in thread
From: Yizhuo @ 2021-07-23 0:36 UTC (permalink / raw)
Cc: Yizhuo, Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
linux-kernel
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 <yzhai003@ucr.edu>
---
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: linux-next: Fixes tag needs some work in the v4l-dvb-next tree
2021-07-22 22:51 linux-next: Fixes tag needs some work in the v4l-dvb-next tree Stephen Rothwell
2021-07-23 0:36 ` [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue" Yizhuo
@ 2021-07-23 0:38 ` Yizhuo Zhai
2021-07-23 0:58 ` Stephen Rothwell
2021-07-23 7:04 ` Mauro Carvalho Chehab
1 sibling, 2 replies; 17+ messages in thread
From: Yizhuo Zhai @ 2021-07-23 0:38 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Mauro Carvalho Chehab, Linux Kernel Mailing List,
Linux Next Mailing List
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 <sfr@canb.auug.org.au> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: linux-next: Fixes tag needs some work in the v4l-dvb-next tree
2021-07-23 0:38 ` linux-next: Fixes tag needs some work in the v4l-dvb-next tree Yizhuo Zhai
@ 2021-07-23 0:58 ` Stephen Rothwell
2021-07-23 2:19 ` Yizhuo Zhai
2021-07-23 7:04 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 17+ messages in thread
From: Stephen Rothwell @ 2021-07-23 0:58 UTC (permalink / raw)
To: Yizhuo Zhai
Cc: Mauro Carvalho Chehab, Linux Kernel Mailing List,
Linux Next Mailing List
[-- Attachment #1: Type: text/plain, Size: 294 bytes --]
Hi Yizhuo,
On Thu, 22 Jul 2021 17:38:13 -0700 Yizhuo Zhai <yzhai003@ucr.edu> 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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: linux-next: Fixes tag needs some work in the v4l-dvb-next tree
2021-07-23 0:58 ` Stephen Rothwell
@ 2021-07-23 2:19 ` Yizhuo Zhai
0 siblings, 0 replies; 17+ messages in thread
From: Yizhuo Zhai @ 2021-07-23 2:19 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Mauro Carvalho Chehab, Linux Kernel Mailing List,
Linux Next Mailing List
Stephen:
Great, thanks.
On Thu, Jul 22, 2021 at 5:58 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi Yizhuo,
>
> On Thu, 22 Jul 2021 17:38:13 -0700 Yizhuo Zhai <yzhai003@ucr.edu> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: linux-next: Fixes tag needs some work in the v4l-dvb-next tree
2021-07-23 0:38 ` linux-next: Fixes tag needs some work in the v4l-dvb-next tree Yizhuo Zhai
2021-07-23 0:58 ` Stephen Rothwell
@ 2021-07-23 7:04 ` Mauro Carvalho Chehab
1 sibling, 0 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2021-07-23 7:04 UTC (permalink / raw)
To: Yizhuo Zhai
Cc: Stephen Rothwell, Linux Kernel Mailing List, Linux Next Mailing List
Em Thu, 22 Jul 2021 17:38:13 -0700
Yizhuo Zhai <yzhai003@ucr.edu> 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 <sfr@canb.auug.org.au> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-07-23 0:36 ` [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue" Yizhuo
@ 2021-07-23 8:10 ` Dan Carpenter
2021-07-23 9:19 ` Yizhuo Zhai
2021-08-11 3:54 ` Yizhuo Zhai
` (2 subsequent siblings)
3 siblings, 1 reply; 17+ messages in thread
From: Dan Carpenter @ 2021-07-23 8:10 UTC (permalink / raw)
To: Yizhuo
Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
linux-kernel
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 <yzhai003@ucr.edu>
> ---
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 <dan.carpenter@oracle.com>
regards,
dan carpenter
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-07-23 8:10 ` Dan Carpenter
@ 2021-07-23 9:19 ` Yizhuo Zhai
0 siblings, 0 replies; 17+ messages in thread
From: Yizhuo Zhai @ 2021-07-23 9:19 UTC (permalink / raw)
To: Dan Carpenter
Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
Linux Kernel Mailing List
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 <dan.carpenter@oracle.com> 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 <yzhai003@ucr.edu>
> > ---
>
> 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 <dan.carpenter@oracle.com>
>
> regards,
> dan carpenter
>
--
Kind Regards,
Yizhuo Zhai
Computer Science, Graduate Student
University of California, Riverside
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-07-23 0:36 ` [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue" Yizhuo
2021-07-23 8:10 ` Dan Carpenter
@ 2021-08-11 3:54 ` Yizhuo Zhai
2021-08-11 4:19 ` Yizhuo Zhai
2021-08-11 7:01 ` Greg Kroah-Hartman
2021-08-12 5:54 ` Yizhuo Zhai
2021-08-12 7:34 ` Yizhuo Zhai
3 siblings, 2 replies; 17+ messages in thread
From: Yizhuo Zhai @ 2021-08-11 3:54 UTC (permalink / raw)
Cc: Yizhuo, Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
linux-kernel
From: Yizhuo <yzhai003@ucr.edu>
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<yzhai003@ucr.edu>
---
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-08-11 3:54 ` Yizhuo Zhai
@ 2021-08-11 4:19 ` Yizhuo Zhai
2021-08-11 7:01 ` Greg Kroah-Hartman
1 sibling, 0 replies; 17+ messages in thread
From: Yizhuo Zhai @ 2021-08-11 4:19 UTC (permalink / raw)
Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
Linux Kernel Mailing List
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 <yzhai003@ucr.edu> wrote:
>
> From: Yizhuo <yzhai003@ucr.edu>
>
> 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<yzhai003@ucr.edu>
> ---
> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-08-11 3:54 ` Yizhuo Zhai
2021-08-11 4:19 ` Yizhuo Zhai
@ 2021-08-11 7:01 ` Greg Kroah-Hartman
2021-08-12 5:50 ` Yizhuo Zhai
1 sibling, 1 reply; 17+ messages in thread
From: Greg Kroah-Hartman @ 2021-08-11 7:01 UTC (permalink / raw)
To: Yizhuo Zhai
Cc: Mauro Carvalho Chehab, Sakari Ailus,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
linux-kernel
On Tue, Aug 10, 2021 at 08:54:03PM -0700, Yizhuo Zhai wrote:
> From: Yizhuo <yzhai003@ucr.edu>
This name is not matching the name you use in your signed-off-by line :(
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-08-11 7:01 ` Greg Kroah-Hartman
@ 2021-08-12 5:50 ` Yizhuo Zhai
0 siblings, 0 replies; 17+ messages in thread
From: Yizhuo Zhai @ 2021-08-12 5:50 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Mauro Carvalho Chehab, Sakari Ailus,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
Linux Kernel Mailing List
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
<gregkh@linuxfoundation.org> wrote:
>
> On Tue, Aug 10, 2021 at 08:54:03PM -0700, Yizhuo Zhai wrote:
> > From: Yizhuo <yzhai003@ucr.edu>
>
> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-07-23 0:36 ` [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue" Yizhuo
2021-07-23 8:10 ` Dan Carpenter
2021-08-11 3:54 ` Yizhuo Zhai
@ 2021-08-12 5:54 ` Yizhuo Zhai
2021-08-12 6:52 ` Sakari Ailus
2021-08-12 6:52 ` Greg Kroah-Hartman
2021-08-12 7:34 ` Yizhuo Zhai
3 siblings, 2 replies; 17+ messages in thread
From: Yizhuo Zhai @ 2021-08-12 5:54 UTC (permalink / raw)
Cc: Yizhuo Zhai, Mauro Carvalho Chehab, Sakari Ailus,
Greg Kroah-Hartman, Juan Antonio Aldea-Armenteros, linux-media,
linux-staging, linux-kernel
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<yzhai003@ucr.edu>
---
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-08-12 5:54 ` Yizhuo Zhai
@ 2021-08-12 6:52 ` Sakari Ailus
2021-08-12 6:52 ` Greg Kroah-Hartman
1 sibling, 0 replies; 17+ messages in thread
From: Sakari Ailus @ 2021-08-12 6:52 UTC (permalink / raw)
To: Yizhuo Zhai
Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
linux-kernel
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<yzhai003@ucr.edu>
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-08-12 5:54 ` Yizhuo Zhai
2021-08-12 6:52 ` Sakari Ailus
@ 2021-08-12 6:52 ` Greg Kroah-Hartman
1 sibling, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2021-08-12 6:52 UTC (permalink / raw)
To: Yizhuo Zhai
Cc: Mauro Carvalho Chehab, Sakari Ailus,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
linux-kernel
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<yzhai003@ucr.edu>
> ---
> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-07-23 0:36 ` [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue" Yizhuo
` (2 preceding siblings ...)
2021-08-12 5:54 ` Yizhuo Zhai
@ 2021-08-12 7:34 ` Yizhuo Zhai
2021-08-12 7:46 ` Greg Kroah-Hartman
3 siblings, 1 reply; 17+ messages in thread
From: Yizhuo Zhai @ 2021-08-12 7:34 UTC (permalink / raw)
Cc: Yizhuo Zhai, Mauro Carvalho Chehab, Sakari Ailus,
Greg Kroah-Hartman, Juan Antonio Aldea-Armenteros, linux-media,
linux-staging, linux-kernel
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 <yzhai003@ucr.edu>
---
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue"
2021-08-12 7:34 ` Yizhuo Zhai
@ 2021-08-12 7:46 ` Greg Kroah-Hartman
0 siblings, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2021-08-12 7:46 UTC (permalink / raw)
To: Yizhuo Zhai
Cc: Mauro Carvalho Chehab, Sakari Ailus,
Juan Antonio Aldea-Armenteros, linux-media, linux-staging,
linux-kernel
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 <yzhai003@ucr.edu>
> ---
> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2021-08-12 7:46 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 22:51 linux-next: Fixes tag needs some work in the v4l-dvb-next tree Stephen Rothwell
2021-07-23 0:36 ` [PATCH v4] media: atomisp: fix the uninitialized use and rename "retvalue" Yizhuo
2021-07-23 8:10 ` Dan Carpenter
2021-07-23 9:19 ` Yizhuo Zhai
2021-08-11 3:54 ` Yizhuo Zhai
2021-08-11 4:19 ` Yizhuo Zhai
2021-08-11 7:01 ` Greg Kroah-Hartman
2021-08-12 5:50 ` Yizhuo Zhai
2021-08-12 5:54 ` Yizhuo Zhai
2021-08-12 6:52 ` Sakari Ailus
2021-08-12 6:52 ` Greg Kroah-Hartman
2021-08-12 7:34 ` Yizhuo Zhai
2021-08-12 7:46 ` Greg Kroah-Hartman
2021-07-23 0:38 ` linux-next: Fixes tag needs some work in the v4l-dvb-next tree Yizhuo Zhai
2021-07-23 0:58 ` Stephen Rothwell
2021-07-23 2:19 ` Yizhuo Zhai
2021-07-23 7:04 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).