All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/sysfb: simpledrm: Improve panel-size validation
Date: Fri, 19 Jun 2026 14:05:24 +0000	[thread overview]
Message-ID: <20260619140524.B58B01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260619135847.309664-3-tzimmermann@suse.de>

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 <tzimmermann@suse.de>

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: stable@vger.kernel.org # 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/20260619135847.309664-1-tzimmermann@suse.de?part=2

  reply	other threads:[~2026-06-19 14:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19 13:56 [PATCH 0/3] drm/sysfb: simpledrm: Various improvements Thomas Zimmermann
2026-06-19 13:56 ` [PATCH 1/3] drm/sysfb: simpledrm: Improve framebuffer-size validation Thomas Zimmermann
2026-06-19 14:13   ` sashiko-bot
2026-06-19 13:56 ` [PATCH 2/3] drm/sysfb: simpledrm: Improve panel-size validation Thomas Zimmermann
2026-06-19 14:05   ` sashiko-bot [this message]
2026-06-19 13:56 ` [PATCH 3/3] drm/sysfb: simpledrm: Read panel orientation from DT node Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260619140524.B58B01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.