[PATCH v2] drm/atmel_hlcdc: Fix uninitialized variable

Advait Dhamorikar posted 1 patch 1 month, 3 weeks ago
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] drm/atmel_hlcdc: Fix uninitialized variable
Posted by Advait Dhamorikar 1 month, 3 weeks ago
atmel_hlcdc_plane_update_buffers: may use an uninitialized
sr variable when the if condition remains unsatisfied.
The variable may contain an arbitrary value left from earlier computations.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202409240320.MZPgi3Up-lkp@intel.com/
Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
---
v1->v2: add reported by and closes labels

 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
Re: [PATCH v2] drm/atmel_hlcdc: Fix uninitialized variable
Posted by Dmitry Baryshkov 1 month, 2 weeks ago
On Mon, Oct 07, 2024 at 08:39:04PM +0530, Advait Dhamorikar wrote:
> atmel_hlcdc_plane_update_buffers: may use an uninitialized
> sr variable when the if condition remains unsatisfied.
> The variable may contain an arbitrary value left from earlier computations.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Closes: https://lore.kernel.org/r/202409240320.MZPgi3Up-lkp@intel.com/
> Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>

Fixes: d498771b0b83 ("drm: atmel_hlcdc: Add support for XLCDC using IP specific driver ops")

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

-- 
With best wishes
Dmitry
Re: [PATCH v2] drm/atmel_hlcdc: Fix uninitialized variable
Posted by Manikandan.M@microchip.com 1 month, 2 weeks ago
On 07/10/24 8:39 pm, Advait Dhamorikar wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> atmel_hlcdc_plane_update_buffers: may use an uninitialized
> sr variable when the if condition remains unsatisfied.
> The variable may contain an arbitrary value left from earlier computations.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Closes: https://lore.kernel.org/r/202409240320.MZPgi3Up-lkp@intel.com/
> Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com>
> ---
> v1->v2: add reported by and closes labels
> 
>   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
> 

-- 
Thanks and Regards,
Manikandan M.