Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH] staging: fbtft: replace number with sizeof()
@ 2026-09-14  9:08 Manuel Ebner
  2026-09-14 10:57 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel Ebner @ 2026-09-14  9:08 UTC (permalink / raw)
  To: Andy Shevchenko, Greg Kroah-Hartman
  Cc: Manuel Ebner, dri-devel, linux-fbdev, linux-staging, linux-kernel

Replace integer number with sizeof with the goal of prevent future truncation bugs.

Signed-off-by: Manuel Ebner <manuelebnerli@mailbox.org>
---
 drivers/staging/fbtft/fb_ili9320.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_ili9320.c b/drivers/staging/fbtft/fb_ili9320.c
index 0f98267a7..655778392 100644
--- a/drivers/staging/fbtft/fb_ili9320.c
+++ b/drivers/staging/fbtft/fb_ili9320.c
@@ -21,7 +21,7 @@
 
 static unsigned int read_devicecode(struct fbtft_par *par)
 {
-	u8 rxbuf[8] = {0, };
+	u8 rxbuf[sizeof(u64)] = {0, };
 
 	write_reg(par, 0x0000);
 	par->fbtftops.read(par, rxbuf, 4);
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: fbtft: replace number with sizeof()
  2026-09-14  9:08 [PATCH] staging: fbtft: replace number with sizeof() Manuel Ebner
@ 2026-09-14 10:57 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-09-14 10:57 UTC (permalink / raw)
  To: Manuel Ebner
  Cc: Andy Shevchenko, Greg Kroah-Hartman, dri-devel, linux-fbdev,
	linux-staging, linux-kernel

On Mon, Sep 14, 2026 at 12:09 PM Manuel Ebner <manuelebnerli@mailbox.org> wrote:
>
> Replace integer number with sizeof with the goal of prevent future truncation bugs.

preventing

>
> Signed-off-by: Manuel Ebner <manuelebnerli@mailbox.org>

So far I see only a single patch, what are the "future truncation
bugs" you are talking about?

...

>  static unsigned int read_devicecode(struct fbtft_par *par)
>  {
> -       u8 rxbuf[8] = {0, };
> +       u8 rxbuf[sizeof(u64)] = {0, };

This is an unclear change. Where did u64 come from? Why do we even
need a 8-byte buffer when we only do 4-byte operations?

>         write_reg(par, 0x0000);
>         par->fbtftops.read(par, rxbuf, 4);

Perhaps you need to read a datasheet for this panel and come up with a
better understanding?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-14 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14  9:08 [PATCH] staging: fbtft: replace number with sizeof() Manuel Ebner
2026-09-14 10:57 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox