mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/atmel_hlcdc: Fix uninitialized variable
@ 2024-10-04 15:08 Advait Dhamorikar
  2024-10-04 19:11 ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Advait Dhamorikar @ 2024-10-04 15:08 UTC (permalink / raw)
  To: Sam Ravnborg, Boris Brezillon, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea
  Cc: dri-devel, linux-arm-kernel, linux-kernel, skhan, anupnewsmail,
	Advait Dhamorikar

atmel_hlcdc_plane_update_buffers: may use an uninitialized
sr variable when the if condition remains unsatisfied

Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 4a7ba0918eca..4150c4d0b4f2 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -559,7 +559,7 @@ static void atmel_hlcdc_plane_update_buffers(struct atmel_hlcdc_plane *plane,
 	const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc;
 	struct atmel_hlcdc_dc *dc = plane->base.dev->dev_private;
 	struct drm_framebuffer *fb = state->base.fb;
-	u32 sr;
+	u32 sr = 0;
 	int i;
 
 	if (!dc->desc->is_xlcdc)
-- 
2.34.1


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

* Re: [PATCH] drm/atmel_hlcdc: Fix uninitialized variable
  2024-10-04 15:08 [PATCH] drm/atmel_hlcdc: Fix uninitialized variable Advait Dhamorikar
@ 2024-10-04 19:11 ` Shuah Khan
  2024-10-07  3:13   ` Manikandan.M
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2024-10-04 19:11 UTC (permalink / raw)
  To: Advait Dhamorikar, Sam Ravnborg, Boris Brezillon,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea
  Cc: dri-devel, linux-arm-kernel, linux-kernel, anupnewsmail, Shuah Khan

On 10/4/24 09:08, Advait Dhamorikar wrote:
> atmel_hlcdc_plane_update_buffers: may use an uninitialized
> sr variable when the if condition remains unsatisfied
> 

As mentioned in my response to another one of your patches,
include how you found the problem in the change log.

> Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
> ---
>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index 4a7ba0918eca..4150c4d0b4f2 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> @@ -559,7 +559,7 @@ static void atmel_hlcdc_plane_update_buffers(struct atmel_hlcdc_plane *plane,
>   	const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc;
>   	struct atmel_hlcdc_dc *dc = plane->base.dev->dev_private;
>   	struct drm_framebuffer *fb = state->base.fb;
> -	u32 sr;
> +	u32 sr = 0;
  
>   	int i;
>   
>   	if (!dc->desc->is_xlcdc)

sr could be used uninitialized in the for loop, !dc->desc->is_xlcdc
case. However, is 0 the right initialization for this value?

thanks,
-- Shuah

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

* Re: [PATCH] drm/atmel_hlcdc: Fix uninitialized variable
  2024-10-04 19:11 ` Shuah Khan
@ 2024-10-07  3:13   ` Manikandan.M
  0 siblings, 0 replies; 3+ messages in thread
From: Manikandan.M @ 2024-10-07  3:13 UTC (permalink / raw)
  To: skhan, advaitdhamorikar, sam, bbrezillon, maarten.lankhorst,
	mripard, tzimmermann, airlied, simona, Nicolas.Ferre,
	alexandre.belloni, claudiu.beznea
  Cc: dri-devel, linux-arm-kernel, linux-kernel, anupnewsmail

Hi Shuah and Advait,

On 05/10/24 12:41 am, Shuah Khan wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know 
> the content is safe
> 
> On 10/4/24 09:08, Advait Dhamorikar wrote:
>> atmel_hlcdc_plane_update_buffers: may use an uninitialized
>> sr variable when the if condition remains unsatisfied
>>
> 
> As mentioned in my response to another one of your patches,
> include how you found the problem in the change log.
> 
This is smatch warning reported by Dan and Kernel Test Robot.
Kindly add the tags mentioned in the below link in the next version.

https://lore.kernel.org/oe-kbuild/202409240320.MZPgi3Up-lkp@intel.com/
>> Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
>> ---
>>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c 
>> b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
>> index 4a7ba0918eca..4150c4d0b4f2 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
>> @@ -559,7 +559,7 @@ static void 
>> atmel_hlcdc_plane_update_buffers(struct atmel_hlcdc_plane *plane,
>>       const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc;
>>       struct atmel_hlcdc_dc *dc = plane->base.dev->dev_private;
>>       struct drm_framebuffer *fb = state->base.fb;
>> -     u32 sr;
>> +     u32 sr = 0;
> 
>>       int i;
>>
>>       if (!dc->desc->is_xlcdc)
> 
> sr could be used uninitialized in the for loop, !dc->desc->is_xlcdc
> case. However, is 0 the right initialization for this value?
> 
initializing sr to 0 is the right way

Thank you for taking care of the same
> thanks,
> -- Shuah

-- 
Thanks and Regards,
Manikandan M.


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

end of thread, other threads:[~2024-10-07  3:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-04 15:08 [PATCH] drm/atmel_hlcdc: Fix uninitialized variable Advait Dhamorikar
2024-10-04 19:11 ` Shuah Khan
2024-10-07  3:13   ` Manikandan.M

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

all inboxes | Powered by JetHome®