Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] Uninitialized stack variable `value` is printed in `drm_dbg()` when 
`of_property_read_u32()` fails.
--

commit a1ba4b62fd041b3fc66d9ae1c41a47b859017d1c
Author: Thomas Zimmermann <[email protected]>

drm/sysfb: simpledrm: Improve panel-size validation

This commit validates the panel size from the device-tree node against
the limitations of struct drm_display_mode and fails transparently on
errors without warning.

Cc: [email protected] # v6.4+

> diff --git a/drivers/gpu/drm/sysfb/simpledrm.c 
> b/drivers/gpu/drm/sysfb/simpledrm.c
> index 03bd19fadccd5..5c1db0785d926 100644
> --- a/drivers/gpu/drm/sysfb/simpledrm.c
> +++ b/drivers/gpu/drm/sysfb/simpledrm.c
> @@ -200,6 +200,35 @@ simplefb_get_memory_of(struct drm_device *dev, struct 
> device_node *of_node)
>       return res;
>  }
>  
> +static u16
> +__simplefb_get_panel_size_mm_of(struct drm_device *dev, struct device_node 
> *of_panel_node,
> +                             const char *name)
> +{
> +     int ret;
> +     u32 value;
> +
> +     ret = of_property_read_u32(of_panel_node, name, &value);
> +     if (ret || value > U16_MAX) {
> +             drm_dbg(dev, "simplefb: cannot parse panel %s: value %u, error 
> %d\n",
> +                     name, value, ret);

[Severity: Low]
Does this code print an uninitialized stack variable when
of_property_read_u32() fails?

If the property is missing from the device tree or another error occurs,
of_property_read_u32() will return a non-zero error code and leave the
value parameter untouched. When this happens, the uninitialized stack
memory will be unconditionally passed to drm_dbg() for printing.

> +             return 0; /* not an error, simply ignore */
> +     }
> +
> +     return value;
> +}

[ ... ]

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to