From: Danny Al-Gaaf Date: Fri, 10 May 2013 15:43:03 +0000 (+0200) Subject: client/SyntheticClient.cc: check return value of describe_layout() X-Git-Tag: v0.63~41^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f6635cb30a2d7bd1bfaaaa211bf0177e0ae5d750;p=ceph.git client/SyntheticClient.cc: check return value of describe_layout() Fix SyntheticClient::chunk_file(): check return value of describe_layout() and handle the error. CID 966615 Unchecked return value (CWE-252) Signed-off-by: Danny Al-Gaaf --- diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index 7a2ab63a1998..fd2c6e57c3fe 100644 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@ -3390,6 +3390,7 @@ int SyntheticClient::lookup_ino(inodeno_t ino) int SyntheticClient::chunk_file(string &filename) { int fd = client->open(filename.c_str(), O_RDONLY); + int ret; struct stat st; client->fstat(fd, &st); @@ -3401,7 +3402,9 @@ int SyntheticClient::chunk_file(string &filename) inode_t inode; memset(&inode, 0, sizeof(inode)); inode.ino = st.st_ino; - client->describe_layout(fd, &inode.layout); + ret = client->describe_layout(fd, &inode.layout); + if (ret < 0) + return ret; uint64_t pos = 0; bufferlist from_before;