Skip to contentSkip to conversation

Add validation for icache/dcache arguments - arguments different from off/on/flush are currently silently ignored.

PATCH New eric.perie at yahoo.com 2 participants 2 messages Jul 13, 2019 – Jul 30, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add validation for icache/dcache arguments - arguments different from off/on/flush are currently silently ignored.

From: Eric Perie <[email protected]>

---
 cmd/cache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
cmd/cache.c +6 -2
index 233f428054..2c687173a8 100644
@@ -22,7 +22,7 @@ void __weak invalidate_icache_all(void)
 static int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	switch (argc) {
-	case 2:			/* on / off	*/
+	case 2:			/* on / off / flush */
 		switch (parse_argv(argv[1])) {
 		case 0:
 			icache_disable();
@@ -33,6 +33,8 @@ static int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		case 2:
 			invalidate_icache_all();
 			break;
+		default:
+			return CMD_RET_USAGE;
 		}
 		break;
 	case 1:			/* get status */
@@ -54,7 +56,7 @@ void __weak flush_dcache_all(void)
 static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	switch (argc) {
-	case 2:			/* on / off */
+	case 2:			/* on / off / flush */
 		switch (parse_argv(argv[1])) {
 		case 0:
 			dcache_disable();
@@ -65,6 +67,8 @@ static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		case 2:
 			flush_dcache_all();
 			break;
+		default:
+			return CMD_RET_USAGE;
 		}
 		break;
 	case 1:			/* get status */
Signature · 1 line
2.22.0
#1 lore raw

PATCH 1/1 Add validation for icache/dcache arguments - arguments different from off/on/flush are currently silently ignored.

Quoted 3 lines · eric.perie at yahoo.com

From: Eric Perie <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190729/077b1f16/attachment.sig>