Message ID | 1466070465-1021-29-git-send-email-hare@suse.de (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | christophe varoqui |
Headers | show |
diff --git a/kpartx/gpt.c b/kpartx/gpt.c index 5a54970..3dac605 100644 --- a/kpartx/gpt.c +++ b/kpartx/gpt.c @@ -206,9 +206,10 @@ read_lba(int fd, uint64_t lba, void *buffer, size_t bytes) int sector_size = get_sector_size(fd); off_t offset = lba * sector_size; uint64_t lastlba; - ssize_t bytesread; + ssize_t bytesread; - lseek(fd, offset, SEEK_SET); + if (lseek(fd, offset, SEEK_SET) < 0) + return 0; bytesread = read(fd, buffer, bytes); lastlba = last_lba(fd);
Found by coverity. Signed-off-by: Hannes Reinecke <hare@suse.com> --- kpartx/gpt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)