diff options
author | Xiao Ni <xni@redhat.com> | 2024-07-26 09:14:13 +0200 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-08-05 11:13:49 +0200 |
commit | eb9834599c8c9764bb3e711b6f291b10797eff27 (patch) | |
tree | 06ac9f2e642ed5e47b0ff3d3b908ebd78a0c7fca | |
parent | mdadm/super0: fix coverity issue CHECKED_RETURN and EVALUATION_ORDER (diff) | |
download | mdadm-eb9834599c8c9764bb3e711b6f291b10797eff27.tar.xz mdadm-eb9834599c8c9764bb3e711b6f291b10797eff27.zip |
mdadm/super1: fix coverity issue CHECKED_RETURN
It needs to check return value when functions return value.
Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
-rw-r--r-- | super1.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -260,7 +260,10 @@ static int aread(struct align_fd *afd, void *buf, int len) n = read(afd->fd, b, iosize); if (n <= 0) return n; - lseek(afd->fd, len - n, 1); + if (lseek(afd->fd, len - n, 1) < 0) { + pr_err("lseek fails\n"); + return -1; + } if (n > len) n = len; memcpy(buf, b, n); @@ -294,14 +297,20 @@ static int awrite(struct align_fd *afd, void *buf, int len) n = read(afd->fd, b, iosize); if (n <= 0) return n; - lseek(afd->fd, -n, 1); + if (lseek(afd->fd, -n, 1) < 0) { + pr_err("lseek fails\n"); + return -1; + } } memcpy(b, buf, len); n = write(afd->fd, b, iosize); if (n <= 0) return n; - lseek(afd->fd, len - n, 1); + if (lseek(afd->fd, len - n, 1) < 0) { + pr_err("lseek fails\n"); + return -1; + } return len; } @@ -2667,7 +2676,10 @@ static int locate_bitmap1(struct supertype *st, int fd, int node_num) } if (mustfree) free(sb); - lseek64(fd, offset<<9, 0); + if (lseek64(fd, offset<<9, 0) < 0) { + pr_err("lseek fails\n"); + ret = -1; + } return ret; } |