]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/librbd/fsx:: Initialize effective_size variable to prevent undefined behavior
authorEdwin Rodriguez <edwin.rodriguez1@ibm.com>
Thu, 7 Aug 2025 15:31:18 +0000 (11:31 -0400)
committerEdwin Rodriguez <edwin.rodriguez1@ibm.com>
Mon, 11 Aug 2025 18:35:20 +0000 (14:35 -0400)
Fixes: https://tracker.ceph.com/issues/72454
Signed-off-by: Edwin Rodriguez <edwin.rodriguez1@ibm.com>
src/test/librbd/fsx.cc

index 27029ed6330a8a0a127bb31f5a25085cd88cec4c..db7019c8e9e38d8ed5f10c41f9d78892993f9c7b 100644 (file)
@@ -1164,7 +1164,7 @@ krbd_resize(struct rbd_ctx *ctx, uint64_t size)
 {
        int ret;
        int count = 0;
-       uint64_t effective_size;
+       uint64_t effective_size = 0;
 
        ceph_assert(size % truncbdy == 0);
 
@@ -1927,7 +1927,7 @@ logdump(void)
                lp = &oplog[i];
                if ((closeopen = lp->operation < 0))
                        lp->operation = ~ lp->operation;
-                       
+
                switch (lp->operation) {
                case OP_MAPREAD:
                        prt("MAPREAD  0x%x thru 0x%x\t(0x%x bytes)",
@@ -2049,7 +2049,7 @@ save_buffer(char *buffer, off_t bufferlength, int fd)
        ret = lseek(fd, (off_t)0, SEEK_SET);
        if (ret == (off_t)-1)
                prterr("save_buffer: lseek 0");
-       
+
        byteswritten = write(fd, buffer, (size_t)bufferlength);
        if (byteswritten != bufferlength) {
                if (byteswritten == -1)
@@ -2066,7 +2066,7 @@ void
 report_failure(int status)
 {
        logdump();
-       
+
        if (fsxgoodfd) {
                if (good_buf) {
                        save_buffer(good_buf, file_size, fsxgoodfd);
@@ -2349,7 +2349,7 @@ check_eofpage(char *s, unsigned offset, char *p, int size)
                return;
        /*
         * we landed in the last page of the file
-        * test to make sure the VM system provided 0's 
+        * test to make sure the VM system provided 0's
         * beyond the true end of the file mapping
         * (as required by mmap def in 1996 posix 1003.1)
         */
@@ -2371,7 +2371,7 @@ void
 gendata(char *original_buf, char *good_buf, unsigned offset, unsigned size)
 {
        while (size--) {
-               good_buf[offset] = testcalls % 256; 
+               good_buf[offset] = testcalls % 256;
                if (offset % 2)
                        good_buf[offset] += original_buf[offset];
                offset++;