Skip to contentSkip to conversation

power: fix: Do not execute pmic command when not all necessary parameters are passed

PATCH In review Lukasz Majewski 2 participants 2 messages Feb 24, 2014 – Feb 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: fix: Do not execute pmic command when not all necessary parameters are passed

Lack of this check resulted in a data abort when CPU tried to execute the following command (without further mandatory input): 'pmic MAX77686_PMIC'.

Only the 'pmic list' command requires one passed parameter. Other require at least two valid parameters for correct operation.

---
 drivers/power/power_core.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/power/power_core.c +3 -0
index 29ccc83..fe1f316 100644
@@ -140,6 +140,9 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return CMD_RET_SUCCESS;
 	}
 
+	if (argc < 3)
+		return CMD_RET_USAGE;
+
 	name = argv[1];
 	cmd = argv[2];
 
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 7 lines · ?ukasz Majewski

Lack of this check resulted in a data abort when CPU tried to execute the following command (without further mandatory input): 'pmic MAX77686_PMIC'.

Only the 'pmic list' command requires one passed parameter. Other require at least two valid parameters for correct operation.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140225/71a6d8aa/attachment.pgp>