]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librbd/fsx.c: fix gcc warning
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 4 Jun 2014 21:10:42 +0000 (23:10 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 4 Jun 2014 21:10:42 +0000 (23:10 +0200)
Initialize pointer with NULL before call posix_memalign() to fix
gcc warning:

test/librbd/fsx.c:1402:13: warning: ‘temp_buf’ may be used
 uninitialized in this function [-Wmaybe-uninitialized]
  if ((ret = ops->read(&cur_ctx, 0, file_info.st_size, temp_buf)) < 0) {
             ^
test/librbd/fsx.c:1398:13: warning: ‘good_buf’ may be used
 uninitialized in this function [-Wmaybe-uninitialized]
  if ((ret = pread(fd, good_buf, file_info.st_size, 0)) < 0) {

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/test/librbd/fsx.c

index 20106e02c1c41b29664bccc78cf1d7353a38acde..a8df394b271e149f5f57e0355f824960ccbf6707 100644 (file)
@@ -1381,6 +1381,7 @@ check_clone(int clonenum)
                exit(169);
        }
 
+       good_buf = NULL;
        ret = posix_memalign((void **)&good_buf, MAX(writebdy, sizeof(void *)),
                             file_info.st_size);
        if (ret > 0) {
@@ -1388,6 +1389,7 @@ check_clone(int clonenum)
                exit(96);
        }
 
+       temp_buf = NULL;
        ret = posix_memalign((void **)&temp_buf, MAX(readbdy, sizeof(void *)),
                             file_info.st_size);
        if (ret > 0) {