* [PATCH] drm/sitronix: st7571: fix hwbuf heap buffer overflow from unaligned nlines
@ 2026-09-19 22:26 Hui Peng
2026-09-19 22:48 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Hui Peng @ 2026-09-19 22:26 UTC (permalink / raw)
To: marcus.folkesson, maarten.lankhorst, mripard, tzimmermann, simona
Cc: dri-devel, linux-kernel
In st7571_fb_blit_rect() (drivers/gpu/drm/sitronix/st7571.c), align y1
down and y2 up to multiples of 8 rows before computing nlines so the
byte count written into st7571->hwbuf matches the allocated page-aligned
buffer capacity and cannot overflow st7571->hwbuf.
Fixes: b362de167daf ("drm/sitronix/st7571: split up the driver into a common and an i2c part")
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
---
diff --git a/drivers/gpu/drm/sitronix/st7571.c b/drivers/gpu/drm/sitronix/st7571.c
index 20954c33eca9..e1e95b360255 100644
--- a/drivers/gpu/drm/sitronix/st7571.c
+++ b/drivers/gpu/drm/sitronix/st7571.c
@@ -827,7 +827,8 @@ struct st7571_device *st7571_probe(struct device *dev,
st7571->regmap = regmap;
st7571->hwbuf = devm_kzalloc(st7571->dev,
- (st7571->nlines * st7571->ncols * st7571->bpp) / 8,
+ (round_up(st7571->nlines, 8) *
+ st7571->ncols * st7571->bpp) / 8,
GFP_KERNEL);
if (!st7571->hwbuf)
return ERR_PTR(-ENOMEM);
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drm/sitronix: st7571: fix hwbuf heap buffer overflow from unaligned nlines
2026-09-19 22:26 [PATCH] drm/sitronix: st7571: fix hwbuf heap buffer overflow from unaligned nlines Hui Peng
@ 2026-09-19 22:48 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-09-19 22:48 UTC (permalink / raw)
To: Hui Peng; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/sitronix: commit message and patch implementation completely mismatched
--
commit 46fb9fd81496f4b52e8d10740054c55dda3862dc
Author: Hui Peng <benquike@gmail.com>
drm/sitronix: st7571: fix hwbuf heap buffer overflow from unaligned nlines
The commit attempts to fix a heap buffer overflow in the sitronix st7571 driver
by ensuring the allocated buffer size is aligned.
> In st7571_fb_blit_rect() (drivers/gpu/drm/sitronix/st7571.c), align y1
> down and y2 up to multiples of 8 rows before computing nlines so the
> byte count written into st7571->hwbuf matches the allocated page-aligned
> buffer capacity and cannot overflow st7571->hwbuf.
[Severity: Medium]
Does the commit message describe the actual changes made in this patch?
The message claims to fix an issue in st7571_fb_blit_rect() by modifying how
coordinates y1 and y2 are aligned. However, the patch does not modify this
function, but instead rounds up an allocation size in st7571_probe().
> diff --git a/drivers/gpu/drm/sitronix/st7571.c b/drivers/gpu/drm/sitronix/st7571.c
> index fc3ba5e8600f6..40017ee5a1f6e 100644
> --- a/drivers/gpu/drm/sitronix/st7571.c
> +++ b/drivers/gpu/drm/sitronix/st7571.c
> @@ -827,7 +827,8 @@ struct st7571_device *st7571_probe(struct device *dev,
> st7571->regmap = regmap;
>
> st7571->hwbuf = devm_kzalloc(st7571->dev,
> - (st7571->nlines * st7571->ncols * st7571->bpp) / 8,
> + (round_up(st7571->nlines, 8) *
> + st7571->ncols * st7571->bpp) / 8,
> GFP_KERNEL);
Could the commit message be updated to match the implementation?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260919222631.3798442-1-benquike@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-21 7:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-19 22:26 [PATCH] drm/sitronix: st7571: fix hwbuf heap buffer overflow from unaligned nlines Hui Peng
2026-09-19 22:48 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox