* [PATCH] platform/chrome: cros_ec_lpc: initialize the buf variable
@ 2023-01-10 19:36 Tom Rix
2023-01-11 3:30 ` patchwork-bot+chrome-platform
2023-01-13 21:20 ` patchwork-bot+chrome-platform
0 siblings, 2 replies; 3+ messages in thread
From: Tom Rix @ 2023-01-10 19:36 UTC (permalink / raw)
To: bleung, groeck, nathan, ndesaulniers
Cc: chrome-platform, linux-kernel, llvm, Tom Rix
Clang static analysis reports this problem
drivers/platform/chrome/cros_ec_lpc.c:379:13: warning: The left operand
of '!=' is a garbage value [core.UndefinedBinaryOperatorResult]
if (buf[0] != 'E' || buf[1] != 'C') {
~~~~~~ ^
The check depends on the side effect of the read. When the read fails
or is short, a buf containing garbage could be mistaken as correct.
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/platform/chrome/cros_ec_lpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 3708fa75feb1..68bba0fcafab 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -350,7 +350,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
struct acpi_device *adev;
acpi_status status;
struct cros_ec_device *ec_dev;
- u8 buf[2];
+ u8 buf[2] = {};
int irq, ret;
/*
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/chrome: cros_ec_lpc: initialize the buf variable
2023-01-10 19:36 [PATCH] platform/chrome: cros_ec_lpc: initialize the buf variable Tom Rix
@ 2023-01-11 3:30 ` patchwork-bot+chrome-platform
2023-01-13 21:20 ` patchwork-bot+chrome-platform
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-01-11 3:30 UTC (permalink / raw)
To: Tom Rix
Cc: bleung, groeck, nathan, ndesaulniers, chrome-platform,
linux-kernel, llvm
Hello:
This patch was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <tzungbi@kernel.org>:
On Tue, 10 Jan 2023 14:36:11 -0500 you wrote:
> Clang static analysis reports this problem
> drivers/platform/chrome/cros_ec_lpc.c:379:13: warning: The left operand
> of '!=' is a garbage value [core.UndefinedBinaryOperatorResult]
> if (buf[0] != 'E' || buf[1] != 'C') {
> ~~~~~~ ^
>
> The check depends on the side effect of the read. When the read fails
> or is short, a buf containing garbage could be mistaken as correct.
>
> [...]
Here is the summary with links:
- platform/chrome: cros_ec_lpc: initialize the buf variable
https://git.kernel.org/chrome-platform/c/2ae3c610e7d2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/chrome: cros_ec_lpc: initialize the buf variable
2023-01-10 19:36 [PATCH] platform/chrome: cros_ec_lpc: initialize the buf variable Tom Rix
2023-01-11 3:30 ` patchwork-bot+chrome-platform
@ 2023-01-13 21:20 ` patchwork-bot+chrome-platform
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-01-13 21:20 UTC (permalink / raw)
To: Tom Rix
Cc: bleung, groeck, nathan, ndesaulniers, chrome-platform,
linux-kernel, llvm
Hello:
This patch was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <tzungbi@kernel.org>:
On Tue, 10 Jan 2023 14:36:11 -0500 you wrote:
> Clang static analysis reports this problem
> drivers/platform/chrome/cros_ec_lpc.c:379:13: warning: The left operand
> of '!=' is a garbage value [core.UndefinedBinaryOperatorResult]
> if (buf[0] != 'E' || buf[1] != 'C') {
> ~~~~~~ ^
>
> The check depends on the side effect of the read. When the read fails
> or is short, a buf containing garbage could be mistaken as correct.
>
> [...]
Here is the summary with links:
- platform/chrome: cros_ec_lpc: initialize the buf variable
https://git.kernel.org/chrome-platform/c/2ae3c610e7d2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-13 21:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-10 19:36 [PATCH] platform/chrome: cros_ec_lpc: initialize the buf variable Tom Rix
2023-01-11 3:30 ` patchwork-bot+chrome-platform
2023-01-13 21:20 ` patchwork-bot+chrome-platform
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox