Bail out of index_mm_open() if fstat() fails
authorLeandro Pereira <leandro@hardinfo.org>
Mon, 28 Apr 2014 23:44:14 +0000 (20:44 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 14 May 2014 23:17:30 +0000 (20:17 -0300)
libkmod/libkmod-index.c

index fa7db41..2136a96 100644 (file)
@@ -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;