Whamcloud - gitweb
LU-17000 lnet: Correctly handle args passed to jt_show_fault() 51/55651/4
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Sun, 7 Jul 2024 01:17:26 +0000 (21:17 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 13 Jul 2024 20:58:25 +0000 (20:58 +0000)
Remove 'return 0' from jt_show_fault() args processing
default case and instead set rc to -EINVAL. This correctly
takes care of bad args passed. Eg: 'lnetctl fault show -x delay'
or 'lnetctl fault show -t'. The 'rc' check deemed unnecessary
by coverity now becomes legit.

Test-Parameters: trivial testlist=sanity-lnet
CoverityID: 429592 ("Logically dead code")
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Id1dc52218405dbd094a7e8304aafeff57b46ab79
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55651
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/utils/lnetctl.c

index f381031..bc600df 100644 (file)
@@ -5866,10 +5866,10 @@ int jt_show_fault(int argc, char **argv)
                        else if (strcmp(optarg, "drop") == 0)
                                opc = LNET_CTL_DROP_LIST;
                        else
-                               return -EINVAL;
+                               rc = -EINVAL;
                        break;
                default:
-                       return 0;
+                       rc = -EINVAL;
                }
        }
        if (rc < 0)