* [PATCH] input: ili210x: Fix uninitialized symbols in ili251x_firmware_to_buffer
@ 2025-04-19 13:13 Purva Yeshi
2025-04-23 7:30 ` Oliver Graute
0 siblings, 1 reply; 3+ messages in thread
From: Purva Yeshi @ 2025-04-19 13:13 UTC (permalink / raw)
To: dmitry.torokhov
Cc: yujiaoliang, jkeeping, oliver.graute, viro, linux-input,
linux-kernel, Purva Yeshi
Fix Smatch-detected issue:
drivers/input/touchscreen/ili210x.c:621 ili251x_firmware_to_buffer()
error: uninitialized symbol 'fw_addr'.
drivers/input/touchscreen/ili210x.c:621 ili251x_firmware_to_buffer()
error: uninitialized symbol 'fw_len'.
Initialize 'fw_addr' and 'fw_len' to 0 in ili251x_firmware_to_buffer()
to avoid uninitialized use warnings reported by smatch.
Although the while loop ensures both variables are always assigned before
use, initializing them silences false positives.
Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
---
drivers/input/touchscreen/ili210x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index fa38d70aded7..10b52d87c41a 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -586,8 +586,8 @@ static const u8 *ili251x_firmware_to_buffer(const struct firmware *fw,
u16 *ac_end, u16 *df_end)
{
const struct ihex_binrec *rec;
- u32 fw_addr, fw_last_addr = 0;
- u16 fw_len;
+ u32 fw_addr = 0, fw_last_addr = 0;
+ u16 fw_len = 0;
/*
* The firmware ihex blob can never be bigger than 64 kiB, so make this
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] input: ili210x: Fix uninitialized symbols in ili251x_firmware_to_buffer
2025-04-19 13:13 [PATCH] input: ili210x: Fix uninitialized symbols in ili251x_firmware_to_buffer Purva Yeshi
@ 2025-04-23 7:30 ` Oliver Graute
2025-04-29 1:24 ` dmitry.torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Graute @ 2025-04-23 7:30 UTC (permalink / raw)
To: Purva Yeshi
Cc: dmitry.torokhov@gmail.com, yujiaoliang@vivo.com,
jkeeping@inmusicbrands.com, viro@zeniv.linux.org.uk,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
On 19/04/25, Purva Yeshi wrote:
> Fix Smatch-detected issue:
>
> drivers/input/touchscreen/ili210x.c:621 ili251x_firmware_to_buffer()
> error: uninitialized symbol 'fw_addr'.
> drivers/input/touchscreen/ili210x.c:621 ili251x_firmware_to_buffer()
> error: uninitialized symbol 'fw_len'.
>
> Initialize 'fw_addr' and 'fw_len' to 0 in ili251x_firmware_to_buffer()
> to avoid uninitialized use warnings reported by smatch.
>
> Although the while loop ensures both variables are always assigned before
> use, initializing them silences false positives.
>
> Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
Reviewed-by: Oliver Graute <oliver.graute@kococonnector.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] input: ili210x: Fix uninitialized symbols in ili251x_firmware_to_buffer
2025-04-23 7:30 ` Oliver Graute
@ 2025-04-29 1:24 ` dmitry.torokhov
0 siblings, 0 replies; 3+ messages in thread
From: dmitry.torokhov @ 2025-04-29 1:24 UTC (permalink / raw)
To: Oliver Graute
Cc: Purva Yeshi, yujiaoliang@vivo.com, jkeeping@inmusicbrands.com,
viro@zeniv.linux.org.uk, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
On Wed, Apr 23, 2025 at 07:30:18AM +0000, Oliver Graute wrote:
> On 19/04/25, Purva Yeshi wrote:
> > Fix Smatch-detected issue:
> >
> > drivers/input/touchscreen/ili210x.c:621 ili251x_firmware_to_buffer()
> > error: uninitialized symbol 'fw_addr'.
> > drivers/input/touchscreen/ili210x.c:621 ili251x_firmware_to_buffer()
> > error: uninitialized symbol 'fw_len'.
> >
> > Initialize 'fw_addr' and 'fw_len' to 0 in ili251x_firmware_to_buffer()
> > to avoid uninitialized use warnings reported by smatch.
> >
> > Although the while loop ensures both variables are always assigned before
> > use, initializing them silences false positives.
> >
> > Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
>
> Reviewed-by: Oliver Graute <oliver.graute@kococonnector.com>
No, we will not be adding gratuitous initializations just to appease
smatch.
That said, "do {} while (rec);" loop might work better here and also
might allow smatch to recognize that both variables are not used
uninitialized. I would accept such a patch.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-29 1:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-19 13:13 [PATCH] input: ili210x: Fix uninitialized symbols in ili251x_firmware_to_buffer Purva Yeshi
2025-04-23 7:30 ` Oliver Graute
2025-04-29 1:24 ` dmitry.torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).