[2.6 patch] drivers/input/serio/libps2.c: ps2_command: add a missing check

Adrian Bunk
2005-03-24T03:18:45Z

The Coverity checker noted that while all other uses of param in
ps2_command() were guarded by a NULL check, this one wasn't.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.12-rc1-mm1-full/drivers/input/serio/libps2.c.old 2005-03-24 02:37:08.000000000 +0100
+++ linux-2.6.12-rc1-mm1-full/drivers/input/serio/libps2.c 2005-03-24 02:38:28.000000000 +0100
@@ -106,9 +106,10 @@ int ps2_command(struct ps2dev *ps2dev, u
command == PS2_CMD_RESET_BAT ? 1000 : 200))
goto out;

- for (i = 0; i < send; i++)
- if (ps2_sendbyte(ps2dev, param[i], 200))
- goto out;
+ if (param)
+ for (i = 0; i < send; i++)
+ if (ps2_sendbyte(ps2dev, param[i], 200))
+ goto out;

/*
* The reset command takes a long time to execute.