summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libkmod/libkmod-index.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c
index fa7db41..2136a96 100644
--- a/libkmod/libkmod-index.c
+++ b/libkmod/libkmod-index.c
@@ -800,7 +800,8 @@ struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename,
goto fail_open;
}
- fstat(fd, &st);
+ if (fstat(fd, &st) < 0)
+ goto fail_nommap;
if ((size_t) st.st_size < sizeof(hdr))
goto fail_nommap;