From 67f2fb636355283a91121a6661ee7a112ab25061 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Fri, 13 Apr 2018 07:43:38 +0900 Subject: [PATCH] app: Fix scan-build errors due to optarg handling Change-Id: Ia952f0a962ee63d25ac5297498bffb7e70e5204b Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/407029 Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp Reviewed-by: Ben Walker Tested-by: SPDK Automated Test System Reviewed-by: Changpeng Liu --- lib/event/app.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/event/app.c b/lib/event/app.c index 635c35bdf..4c619f4f6 100644 --- a/lib/event/app.c +++ b/lib/event/app.c @@ -597,15 +597,27 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts, rval = SPDK_APP_PARSE_ARGS_HELP; goto parse_done; case 'i': + if (optarg == NULL) { + rval = SPDK_APP_PARSE_ARGS_FAIL; + goto parse_done; + } opts->shm_id = atoi(optarg); break; case 'm': opts->reactor_mask = optarg; break; case 'n': + if (optarg == NULL) { + rval = SPDK_APP_PARSE_ARGS_FAIL; + goto parse_done; + } opts->mem_channel = atoi(optarg); break; case 'p': + if (optarg == NULL) { + rval = SPDK_APP_PARSE_ARGS_FAIL; + goto parse_done; + } opts->master_core = atoi(optarg); break; case 'q':