Found by coverity.
Signed-off-by: Hannes Reinecke <[email protected]>
---
kpartx/gpt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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);
--
2.6.6
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel