summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2013-05-10 17:43:03 +0200
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>2013-05-11 00:02:56 +0200
commitf6635cb30a2d7bd1bfaaaa211bf0177e0ae5d750 (patch)
tree40292b402325bdf87ccdfdd721f07778894fa042 /src
parentclient/Client.cc: fix possible NULL pointer dereference (diff)
downloadceph-f6635cb30a2d7bd1bfaaaa211bf0177e0ae5d750.tar.xz
ceph-f6635cb30a2d7bd1bfaaaa211bf0177e0ae5d750.zip
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 <danny.al-gaaf@bisect.de>
Diffstat (limited to 'src')
-rw-r--r--src/client/SyntheticClient.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc
index 7a2ab63a199..fd2c6e57c3f 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;