From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/sysfb: simpledrm: Improve framebuffer-size validation
Date: Fri, 19 Jun 2026 14:13:57 +0000 [thread overview]
Message-ID: <20260619141357.945271F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260619135847.309664-2-tzimmermann@suse.de>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Low] The patch updates all callers of the local static wrapper `simplefb_get_validated_int0()` to call `drm_sysfb_get_validated_int0()` directly, but leaves the static function definition behind, causing a compiler warning.
Pre-existing issues:
- [High] Missing validation between the firmware-provided framebuffer dimensions (stride, width, height) and the size of the memory region allows out-of-bounds virtual memory writes.
--
commit 934b7fe8edd3f05582affbe138506d555774f080
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/sysfb: simpledrm: Improve framebuffer-size validation
Validate the framebuffer size from the firmware against the limitations of
struct drm_display_mode. Fail probing on errors if the size exceeds the
16-bit fields.
> diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
> index fc168920f2c64..03bd19fadccd5 100644
> --- a/drivers/gpu/drm/sysfb/simpledrm.c
> +++ b/drivers/gpu/drm/sysfb/simpledrm.c
> @@ -88,14 +88,14 @@ static int
> simplefb_get_width_pd(struct drm_device *dev,
> const struct simplefb_platform_data *pd)
> {
> - return simplefb_get_validated_int0(dev, "width", pd->width);
> + return drm_sysfb_get_validated_int0(dev, "width", pd->width, U16_MAX);
> }
[Severity: Low]
Does this leave simplefb_get_validated_int0() as an unused static function?
Since all four callers (simplefb_get_width_pd, simplefb_get_height_pd,
simplefb_get_width_of, simplefb_get_height_of) are updated to call
drm_sysfb_get_validated_int0() directly, simplefb_get_validated_int0()
appears to have zero callers remaining in simpledrm.c. This can trigger a
-Wunused-function compiler warning.
[Severity: High]
This isn't a bug introduced by this patch, but while we are improving the
validation of framebuffer dimensions from firmware, should we also validate
that the resulting framebuffer size actually fits within the mapped memory
region?
The firmware-provided stride and height are used to calculate the framebuffer
size, but when acquiring the memory region:
drivers/gpu/drm/sysfb/simpledrm.c:simpledrm_device_create() {
...
screen_base = devm_memremap(dev->dev, mem->start, resource_size(mem), MEMREMAP_WC);
...
}
or the fallback:
drivers/gpu/drm/sysfb/simpledrm.c:simpledrm_device_create() {
...
screen_base = devm_ioremap_wc(&pdev->dev, mem->start, resource_size(mem));
...
}
It seems we map exactly resource_size(mem) bytes without verifying if
(stride * height) exceeds that size. If the firmware provides a mismatched
configuration, out-of-bounds writes could occur during plane updates when
copying pixel data into sysfb->fb_addr.
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260619135847.309664-1-tzimmermann@suse.de?part=1
next prev parent reply other threads:[~2026-06-19 14:14 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 [this message]
2026-06-19 13:56 ` [PATCH 2/3] drm/sysfb: simpledrm: Improve panel-size validation Thomas Zimmermann
2026-06-19 14:05 ` sashiko-bot
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=20260619141357.945271F000E9@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.