Commit 0e653b6a authored by Ye Li's avatar Ye Li

MLK-20239-6 imx8m: Fix coverity CID 1900601

Fix coverity issue CID 1900601: Unchecked return value from library (CHECKED_RETURN)
check_return: Calling lseek(ifd, offset, 0) without checking return value.
This library function may fail and return an error code
Signed-off-by: default avatarYe Li <ye.li@nxp.com>
parent 75d4a2ca
......@@ -297,7 +297,7 @@ copy_file (int ifd, const char *datafile, int pad, int offset, int datafile_offs
int tail;
int zero = 0;
uint8_t zeros[4096];
int size;
int size, ret;
memset(zeros, 0, sizeof(zeros));
......@@ -321,7 +321,12 @@ copy_file (int ifd, const char *datafile, int pad, int offset, int datafile_offs
}
size = sbuf.st_size - datafile_offset;
lseek(ifd, offset, SEEK_SET);
ret = lseek(ifd, offset, SEEK_SET);
if (ret < 0) {
fprintf(stderr, "%s: lseek error %s\n",
__func__, strerror(errno));
exit(EXIT_FAILURE);
}
if (write(ifd, ptr + datafile_offset, size) != size) {
fprintf (stderr, "Write error %s\n",
strerror(errno));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment