Fixing the possible NULL pointer issued reported from Coverity
case 'e':
CID 424708: (FORWARD_NULL)
Passing null pointer "optarg" to "strtoul", which dereferences it.
end_qid = strtoul(optarg, NULL, 0);
break;
CoverityID: 424708 ("FORWARD NULL")
Signed-off-by: Hongchao Zhang <hongchao@whamcloud.com>
Change-Id: Idfb5cb4c6fe63ec08dd9048742f3f280b125eb8a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54827
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
qctl->qc_cmd = LUSTRE_Q_ITERQUOTA;
break;
case 'e':
+ if (optarg == NULL || *optarg == '\0') {
+ fprintf(stderr,
+ "%s quota: invalid start quota ID\n",
+ progname);
+ rc = CMD_HELP;
+ goto out;
+ }
end_qid = strtoul(optarg, NULL, 0);
break;
case 'G':
quiet = 1;
break;
case 's':
+ if (optarg == NULL || *optarg == '\0') {
+ fprintf(stderr,
+ "%s quota: invalid start quota ID\n",
+ progname);
+ rc = CMD_HELP;
+ goto out;
+ }
start_qid = strtoul(optarg, NULL, 0);
break;
case 't':