]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hibernate-util: read_fiemap: add missing asserts
authorMike Yuan <me@yhndnzj.com>
Sat, 30 Sep 2023 15:32:08 +0000 (23:32 +0800)
committerMike Yuan <me@yhndnzj.com>
Fri, 20 Oct 2023 15:22:28 +0000 (23:22 +0800)
src/shared/hibernate-util.c

index c6c58f8e5d48248526aa10291f18ab47146d9746..97568aae6896349eca757a1d462f4ac7237a4515 100644 (file)
@@ -390,6 +390,9 @@ int read_fiemap(int fd, struct fiemap **ret) {
         uint64_t fiemap_start = 0, fiemap_length;
         const size_t n_extra = DIV_ROUND_UP(sizeof(struct fiemap), sizeof(struct fiemap_extent));
 
+        assert(fd >= 0);
+        assert(ret);
+
         if (fstat(fd, &statinfo) < 0)
                 return log_debug_errno(errno, "Cannot determine file size: %m");
         if (!S_ISREG(statinfo.st_mode))