Skip to content

Commit 2ae3c61

Browse files
Tom RixTzung-Bi Shih
authored andcommitted
platform/chrome: cros_ec_lpc: initialize the buf variable
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 <[email protected]> Signed-off-by: Tzung-Bi Shih <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9e69b1b commit 2ae3c61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/platform/chrome/cros_ec_lpc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
350350
struct acpi_device *adev;
351351
acpi_status status;
352352
struct cros_ec_device *ec_dev;
353-
u8 buf[2];
353+
u8 buf[2] = {};
354354
int irq, ret;
355355

356356
/*

0 commit comments

Comments
 (0)