From: sashiko-bot@kernel.org
To: "Panagiotis Gravias" <graviaspanagiotis1@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis
Date: Tue, 14 Jul 2026 19:33:35 +0000 [thread overview]
Message-ID: <20260714193336.1BAD51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260714190958.219437-4-graviaspanagiotis1@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Constructing and dereferencing unaligned 16-bit pointers causes undefined behavior and potential kernel panics on strict-alignment architectures.
- [High] Incorrect SPI buffer size calculation transmits uninitialized memory when multiple parameters are sent with `startbyte` enabled.
--
--- Patch [1]: [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis ---
commit b5aeca6fddf7088401c92f0dfc0d9c7d04fb863a
Author: Panagiotis Gravias <graviaspanagiotis1@gmail.com>
staging/fbtft: Remove prohibited space before close parenthesis
This commit cleans up a checkpatch error by removing a prohibited space
before the close parenthesis in the define_fbtft_write_reg macro
invocations.
> diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
> index 30e436ff19e4c..38697992f5e1b 100644
> --- a/drivers/staging/fbtft/fbtft-bus.c
> +++ b/drivers/staging/fbtft/fbtft-bus.c
> @@ -62,9 +62,9 @@ out: \
> } \
> EXPORT_SYMBOL(func);
>
> -define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
> +define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8,)
> define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
> -define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
> +define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16,)
[Severity: High]
This is a pre-existing issue, but does expanding this macro for 16-bit
types like fbtft_write_reg16_bus16 create an unaligned pointer dereference?
In the define_fbtft_write_reg() macro definition, when a startbyte is used:
if (par->startbyte) {
*(u8 *)par->buf = par->startbyte;
buf = (buffer_type *)(par->buf + 1);
offset = 1;
}
The pointer is advanced by 1 byte. When buffer_type is a 16-bit type, this
creates an odd-aligned pointer. Later, the macro writes to it:
*buf = modifier((data_type)va_arg(args, unsigned int));
This can cause unaligned memory access faults and lead to kernel panics on
strict-alignment architectures. This same pattern also appears in
fbtft_write_vmem16_bus8() where par->txbuf.buf + 1 is cast to a 16-bit
pointer.
[Severity: High]
This is also a pre-existing issue within the same macro, but could the
SPI buffer size calculation send uninitialized memory?
When sending multiple parameters with a startbyte active, the macro packs
exactly one start byte followed by the parameters. However, the transmission
size is calculated as:
if (len) {
...
fbtft_write_buf_dc(par, par->buf,
len * (sizeof(data_type) + offset), 1);
}
Because offset is 1, if len is greater than 1, this calculates to
len * sizeof(data_type) + len, instead of the actual payload size of
1 + len * sizeof(data_type). Could this force the SPI core to transmit extra
uninitialized out-of-bounds bytes and potentially corrupt the display
controller's initialization state?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260714190958.219437-2-graviaspanagiotis1@gmail.com?part=1
next prev parent reply other threads:[~2026-07-14 19:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 19:09 [PATCH 0/3] staging/fbtft: Minor cleanups Panagiotis Gravias
2026-07-14 19:09 ` [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis Panagiotis Gravias
2026-07-14 19:16 ` Andy Shevchenko
2026-07-14 19:33 ` sashiko-bot [this message]
2026-07-14 19:09 ` [PATCH 2/3] staging/fbtft: Align arguments to match open parenthesis Panagiotis Gravias
2026-07-14 19:16 ` Andy Shevchenko
2026-07-14 19:09 ` [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range Panagiotis Gravias
2026-07-14 19:17 ` Andy Shevchenko
2026-07-14 19:48 ` sashiko-bot
2026-07-14 19:18 ` [PATCH 0/3] staging/fbtft: Minor cleanups Andy Shevchenko
2026-07-15 7:28 ` Dan Carpenter
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=20260714193336.1BAD51F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=graviaspanagiotis1@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox