ihex: restore missing default in switch statement
PATCH 1/1 ihex: restore missing default in switch statement
Commit 2473238eac95 ("ihex: add support for CS:IP/EIP records") removes the "default:" statement in the switch block, making the "return usage();" line dead code and ihex2fw silently ignoring unknown options. Restore this statement.
This bug was found by building with HOSTCC=clang and adding -Wunreachable-code-return to HOSTCFLAGS.
--- firmware/ihex2fw.c | 1 + 1 file changed, 1 insertion(+)
firmware/ihex2fw.c +1 -0
@@ -86,6 +86,7 @@ int main(int argc, char **argv)case 'j' : include_jump =1 ;break ; +default :return usage (); } }
Signature · 1 line
2.3.1
Quoted 13 lines · On Wed, 4 Mar 2015 22:24:10 +0800 Nicolas Iooss <[email protected]>…
Commit
2473238eac95("ihex: add support for CS:IP/EIP records") removes the "default:" statement in the switch block, making the "returnusage();" line dead code and ihex2fw silently ignoring unknown options. Restore this statement.This bug was found by building with HOSTCC=clang and adding
(quoted diff) +0
-1-Wunreachable-code-return to HOSTCFLAGS.
firmware/ihex2fw.c int main(int argc, char **argv) · line 92
Quoted 7 lines
firmware/ihex2fw.c +1
-0@@ -86,6 +86,7 @@ int main(int argc, char **argv)case 'j' : include_jump =1 ;break ; +default :return usage (); } }
whee. So if there's userspace out there which is passing bad options to ihex2fw, this fix will break it.
Oh well, I expect we'll survive.