From 21a2c129adaab04a7a032a31c816ae09375fe954 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 9 Jan 2024 17:57:16 -0500 Subject: getchar(): Correct usage The function getchar() returns an 'int' and not a 'char'. Coverity notes that "Assigning the return value of getchar to char ... truncates its value." and so for the most part we can resolve this easily by using 'int' as intended, and often used throughout the codebase. A few places are not so simple and would require further re-architecting of the code in order to change this, so we leave them be. Signed-off-by: Tom Rini --- cmd/load.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/load.c b/cmd/load.c index 2715cf5957e..540361b43f0 100644 --- a/cmd/load.c +++ b/cmd/load.c @@ -230,7 +230,7 @@ static ulong load_serial(long offset) static int read_record(char *buf, ulong len) { char *p; - char c; + int c; --len; /* always leave room for terminating '\0' byte */ @@ -827,7 +827,7 @@ static void handle_send_packet(int n) /* k_recv receives a OS Open image file over kermit line */ static int k_recv(void) { - char new_char; + int new_char; char k_state, k_state_saved; int sum; int done; -- cgit v1.2.3 From 0afee2623d5a313473cb9b57df2fbadf54f86b82 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 11 Jan 2024 09:14:33 +0100 Subject: cmd: bootflow: remove dead code in do_bootflow_cmdline() Checking argc < 3 twice is redundant. Addresses-Coverity-ID: 477198 Logically dead code Fixes: 921f63e57238 ("bootflow: Allow setting a cmdline arg with no value") Signed-off-by: Heinrich Schuchardt --- cmd/bootflow.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'cmd') diff --git a/cmd/bootflow.c b/cmd/bootflow.c index cc6dfae1668..be5d7d8e743 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -543,8 +543,6 @@ static int do_bootflow_cmdline(struct cmd_tbl *cmdtp, int flag, int argc, op = argv[1]; arg = argv[2]; if (*op == 's') { - if (argc < 3) - return CMD_RET_USAGE; val = argv[3] ?: (const char *)BOOTFLOWCL_EMPTY; } -- cgit v1.2.3 From cf536daeedf559d4192b1a9c85e0745a904b9204 Mon Sep 17 00:00:00 2001 From: Ivan Orlov Date: Thu, 11 Jan 2024 12:58:19 +0000 Subject: cmd: license: Add CONFIG_GZIP dependency 'License' command processing code could be successfully compiled only when CONFIG_GZIP option is enabled, otherwise it can't find the 'gunzip' function definition (it is defined in lib/gunzip.c). Add CONFIG_GZIP dependency to 'license' command config option in the corresponding Kconfig. Signed-off-by: Ivan Orlov --- cmd/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index 46600e5007d..50625e7c16a 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -192,6 +192,7 @@ config CMD_HISTORY config CMD_LICENSE bool "license" select BUILD_BIN2C + depends on GZIP help Print GPL license text -- cgit v1.2.3