From: Edwin Rodriguez Date: Thu, 7 Aug 2025 15:31:18 +0000 (-0400) Subject: test/librbd/fsx:: Initialize effective_size variable to prevent undefined behavior X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ead0d4893e3867c5cb146b6bdc448835c3ea7f70;p=ceph.git test/librbd/fsx:: Initialize effective_size variable to prevent undefined behavior Fixes: https://tracker.ceph.com/issues/72454 Signed-off-by: Edwin Rodriguez --- diff --git a/src/test/librbd/fsx.cc b/src/test/librbd/fsx.cc index 27029ed6330a..db7019c8e9e3 100644 --- a/src/test/librbd/fsx.cc +++ b/src/test/librbd/fsx.cc @@ -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++;