Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/37421 )
Change subject: Fix CID 264287 Unchecked return value from library ......................................................................
Fix CID 264287 Unchecked return value from library
The return code of mkdir() wasn't checked.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: I34d2d49d0ea17598f7bcfb56ee5debd9bd352b82 Reviewed-on: https://review.coreboot.org/c/em100/+/37421 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Georgi pgeorgi@google.com --- M em100.c 1 file changed, 5 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/em100.c b/em100.c index aa16e8a..301d574 100644 --- a/em100.c +++ b/em100.c @@ -722,7 +722,11 @@ if (dir) { // success } else if (errno == ENOENT) { - mkdir(directory, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); + if (mkdir(directory, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + perror(directory); + directory[0]=0; + return NULL; + } } else { perror("EM100_HOME inaccessible"); directory[0]=0;