Merge pull request #15009 from tchaikov/wip-kill-warnings

libradosstriper: do not assign garbage to returned value

Reviewed-by: Brad Hubbard <bhubbard@redhat.com>
This commit is contained in:
Kefu Chai 2017-05-12 19:34:13 +08:00 committed by GitHub
commit a4d4a9bcc9
3 changed files with 11 additions and 7 deletions

View File

@ -1169,10 +1169,13 @@ int libradosstriper::RadosStriperImpl::internal_get_layout_and_size(
// deal with size
size_t ssize;
rc = extract_sizet_attr(attrs, XATTR_SIZE, &ssize);
if (rc) {
return rc;
}
*size = ssize;
// make valgrind happy by setting unused fl_pg_pool
layout->fl_pg_pool = 0;
return rc;
return 0;
}
int libradosstriper::RadosStriperImpl::openStripedObjectForRead(

View File

@ -3,7 +3,7 @@ add_executable(simple_server
simple_dispatcher.cc
)
target_link_libraries(simple_server
os global ceph-common
global ceph-common
${EXTRALIBS}
${CMAKE_DL_LIBS}
)
@ -13,7 +13,7 @@ add_executable(simple_client
simple_dispatcher.cc
)
target_link_libraries(simple_client
os global ceph-common
global ceph-common
${EXTRALIBS}
${CMAKE_DL_LIBS}
)
@ -24,7 +24,7 @@ if(HAVE_XIO)
xio_dispatcher.cc
)
target_link_libraries(xio_server
os global ceph-common
global ceph-common
${XIO_LIBRARY} pthread rt
${EXTRALIBS}
${CMAKE_DL_LIBS}
@ -35,7 +35,7 @@ if(HAVE_XIO)
xio_dispatcher.cc
)
target_link_libraries(xio_client
os global ceph-common
global ceph-common
${XIO_LIBRARY} pthread rt
${EXTRALIBS}
${CMAKE_DL_LIBS}

View File

@ -107,11 +107,12 @@ static inline Message* new_simple_ping_with_data(const char *tag,
for (uint32_t i = 0; i < nfrags; ++i) {
if (do_page_alignment) {
if (posix_memalign(&p, pagesize, segsize))
p = NULL;
p = nullptr;
} else {
p = malloc(segsize);
}
if (!p)
throw std::bad_alloc();
strcpy((char*) p, tag);
uint32_t* t = (uint32_t* ) (((char*) p) + segsize - 32);
*t = counter;