aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-08-16 19:35:37 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-22 11:59:17 +1000
commitc98d7a1f8197b8d45ec8b99c4deb213c0c455c0f (patch)
treeb1091343931694016b7f9f15a495aed61b920fdb /external
parent79dcb114de9bb280d39b457cb3c32ca5a291b4fc (diff)
downloadskiboot-c98d7a1f8197b8d45ec8b99c4deb213c0c455c0f.zip
skiboot-c98d7a1f8197b8d45ec8b99c4deb213c0c455c0f.tar.gz
skiboot-c98d7a1f8197b8d45ec8b99c4deb213c0c455c0f.tar.bz2
external/pflash: Silence false positive Coverity CID 163739
Several of the cases in the getopt loop take the optarg pointer and pass it to functions which will dereference it. There is currently no bug as all of these are marked to getopt as having a requirement argument so optarg will never be null. The rationale for this patch is firstly to silence coverity as it is fairly simple to do. More importantly having a brand new version of this Coverity error appear in the event of a future mistake with optional arguments to getopt will be useful. Fixes: CID 163739 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/pflash/pflash.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index a08ea94..ed33a6f 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -753,6 +753,8 @@ int main(int argc, char *argv[])
disable_4B = true;
break;
case 'r':
+ if (!optarg)
+ break;
do_read = true;
free(read_file);
read_file = strdup(optarg);
@@ -767,6 +769,8 @@ int main(int argc, char *argv[])
direct = true;
break;
case 'p':
+ if (!optarg)
+ break;
program = true;
free(write_file);
write_file = strdup(optarg);
@@ -803,6 +807,8 @@ int main(int argc, char *argv[])
flash_side = atoi(optarg);
break;
case 'T':
+ if (!optarg)
+ break;
ffs_toc_seen = true;
flash.toc = strtoul(optarg, &endptr, 0);
if (*endptr != '\0') {