* [PATCH] media: atomisp-mt9m114: Fix pointer dereferenced before checking @ 2022-05-30 7:58 Haowen Bai 2022-05-30 9:25 ` Dan Carpenter 2022-05-30 11:22 ` Tommaso Merciai 0 siblings, 2 replies; 5+ messages in thread From: Haowen Bai @ 2022-05-30 7:58 UTC (permalink / raw) To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman Cc: Haowen Bai, linux-media, linux-staging, linux-kernel The info->data is dereferencing before null checking, so move it after checking. Signed-off-by: Haowen Bai <baihaowen@meizu.com> --- drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index 00d6842c07d6..3c81ab73cdae 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -616,13 +616,15 @@ static int mt9m114_get_intg_factor(struct i2c_client *client, struct camera_mipi_info *info, const struct mt9m114_res_struct *res) { - struct atomisp_sensor_mode_data *buf = &info->data; + struct atomisp_sensor_mode_data *buf; u32 reg_val; int ret; if (!info) return -EINVAL; + buf = &info->data; + ret = mt9m114_read_reg(client, MISENSOR_32BIT, REG_PIXEL_CLK, ®_val); if (ret) -- 2.7.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] media: atomisp-mt9m114: Fix pointer dereferenced before checking 2022-05-30 7:58 [PATCH] media: atomisp-mt9m114: Fix pointer dereferenced before checking Haowen Bai @ 2022-05-30 9:25 ` Dan Carpenter 2022-05-30 11:22 ` Tommaso Merciai 1 sibling, 0 replies; 5+ messages in thread From: Dan Carpenter @ 2022-05-30 9:25 UTC (permalink / raw) To: Haowen Bai Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman, linux-media, linux-staging, linux-kernel On Mon, May 30, 2022 at 03:58:01PM +0800, Haowen Bai wrote: > The info->data is dereferencing before null checking, so move > it after checking. > > Signed-off-by: Haowen Bai <baihaowen@meizu.com> > --- > drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c > index 00d6842c07d6..3c81ab73cdae 100644 > --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c > +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c > @@ -616,13 +616,15 @@ static int mt9m114_get_intg_factor(struct i2c_client *client, > struct camera_mipi_info *info, > const struct mt9m114_res_struct *res) > { > - struct atomisp_sensor_mode_data *buf = &info->data; > + struct atomisp_sensor_mode_data *buf; This is not a dereference, it's just doing pointer math. Not a bug. regards, dan carpenter ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: atomisp-mt9m114: Fix pointer dereferenced before checking 2022-05-30 7:58 [PATCH] media: atomisp-mt9m114: Fix pointer dereferenced before checking Haowen Bai 2022-05-30 9:25 ` Dan Carpenter @ 2022-05-30 11:22 ` Tommaso Merciai 2022-05-30 11:37 ` Tommaso Merciai 1 sibling, 1 reply; 5+ messages in thread From: Tommaso Merciai @ 2022-05-30 11:22 UTC (permalink / raw) To: Haowen Bai Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman, linux-media, linux-staging, linux-kernel On Mon, May 30, 2022 at 03:58:01PM +0800, Haowen Bai wrote: > The info->data is dereferencing before null checking, so move > it after checking. > > Signed-off-by: Haowen Bai <baihaowen@meizu.com> > --- > drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c > index 00d6842c07d6..3c81ab73cdae 100644 > --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c > +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c > @@ -616,13 +616,15 @@ static int mt9m114_get_intg_factor(struct i2c_client *client, > struct camera_mipi_info *info, > const struct mt9m114_res_struct *res) > { > - struct atomisp_sensor_mode_data *buf = &info->data; > + struct atomisp_sensor_mode_data *buf; > u32 reg_val; > int ret; > > if (!info) > return -EINVAL; > > + buf = &info->data; > + > ret = mt9m114_read_reg(client, MISENSOR_32BIT, > REG_PIXEL_CLK, ®_val); > if (ret) > -- > 2.7.4 > Hi Haowen, Looks good to me, thanks. Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> -- Tommaso Merciai Embedded Linux Engineer tommaso.merciai@amarulasolutions.com __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@amarulasolutions.com www.amarulasolutions.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: atomisp-mt9m114: Fix pointer dereferenced before checking 2022-05-30 11:22 ` Tommaso Merciai @ 2022-05-30 11:37 ` Tommaso Merciai 2022-05-31 1:41 ` baihaowen 0 siblings, 1 reply; 5+ messages in thread From: Tommaso Merciai @ 2022-05-30 11:37 UTC (permalink / raw) To: Haowen Bai Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman, linux-media, linux-staging, linux-kernel On Mon, May 30, 2022 at 01:22:32PM +0200, Tommaso Merciai wrote: > On Mon, May 30, 2022 at 03:58:01PM +0800, Haowen Bai wrote: > > The info->data is dereferencing before null checking, so move > > it after checking. > > > > Signed-off-by: Haowen Bai <baihaowen@meizu.com> > > --- > > drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c > > index 00d6842c07d6..3c81ab73cdae 100644 > > --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c > > +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c > > @@ -616,13 +616,15 @@ static int mt9m114_get_intg_factor(struct i2c_client *client, > > struct camera_mipi_info *info, > > const struct mt9m114_res_struct *res) > > { > > - struct atomisp_sensor_mode_data *buf = &info->data; > > + struct atomisp_sensor_mode_data *buf; > > u32 reg_val; > > int ret; > > > > if (!info) > > return -EINVAL; > > > > + buf = &info->data; > > + > > ret = mt9m114_read_reg(client, MISENSOR_32BIT, > > REG_PIXEL_CLK, ®_val); > > if (ret) > > -- > > 2.7.4 > > > > Hi Haowen, > Looks good to me, thanks. > > Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Hi, My bad, Dan is right. Nothing to fix here. Sorry for previous review. Regards, Tommaso > -- > Tommaso Merciai > Embedded Linux Engineer > tommaso.merciai@amarulasolutions.com > __________________________________ > > Amarula Solutions SRL > Via Le Canevare 30, 31100 Treviso, Veneto, IT > T. +39 042 243 5310 > info@amarulasolutions.com > www.amarulasolutions.com -- Tommaso Merciai Embedded Linux Engineer tommaso.merciai@amarulasolutions.com __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@amarulasolutions.com www.amarulasolutions.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: atomisp-mt9m114: Fix pointer dereferenced before checking 2022-05-30 11:37 ` Tommaso Merciai @ 2022-05-31 1:41 ` baihaowen 0 siblings, 0 replies; 5+ messages in thread From: baihaowen @ 2022-05-31 1:41 UTC (permalink / raw) To: Tommaso Merciai Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman, linux-media, linux-staging, linux-kernel 在 2022/5/30 下午7:37, Tommaso Merciai 写道: > On Mon, May 30, 2022 at 01:22:32PM +0200, Tommaso Merciai wrote: >> On Mon, May 30, 2022 at 03:58:01PM +0800, Haowen Bai wrote: >>> The info->data is dereferencing before null checking, so move >>> it after checking. >>> >>> Signed-off-by: Haowen Bai <baihaowen@meizu.com> >>> --- >>> drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c >>> index 00d6842c07d6..3c81ab73cdae 100644 >>> --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c >>> +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c >>> @@ -616,13 +616,15 @@ static int mt9m114_get_intg_factor(struct i2c_client *client, >>> struct camera_mipi_info *info, >>> const struct mt9m114_res_struct *res) >>> { >>> - struct atomisp_sensor_mode_data *buf = &info->data; >>> + struct atomisp_sensor_mode_data *buf; >>> u32 reg_val; >>> int ret; >>> >>> if (!info) >>> return -EINVAL; >>> >>> + buf = &info->data; >>> + >>> ret = mt9m114_read_reg(client, MISENSOR_32BIT, >>> REG_PIXEL_CLK, ®_val); >>> if (ret) >>> -- >>> 2.7.4 >>> >> Hi Haowen, >> Looks good to me, thanks. >> >> Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> > Hi, > My bad, Dan is right. Nothing to fix here. > Sorry for previous review. > > Regards, > Tommaso >> -- >> Tommaso Merciai >> Embedded Linux Engineer >> tommaso.merciai@amarulasolutions.com >> __________________________________ >> >> Amarula Solutions SRL >> Via Le Canevare 30, 31100 Treviso, Veneto, IT >> T. +39 042 243 5310 >> info@amarulasolutions.com >> www.amarulasolutions.com hi, Dan Thank you for pointing out. I'm clear now. -- Haowen Bai ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-31 1:41 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-05-30 7:58 [PATCH] media: atomisp-mt9m114: Fix pointer dereferenced before checking Haowen Bai 2022-05-30 9:25 ` Dan Carpenter 2022-05-30 11:22 ` Tommaso Merciai 2022-05-30 11:37 ` Tommaso Merciai 2022-05-31 1:41 ` baihaowen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox