diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-05-10 17:43:03 +0200 |
---|---|---|
committer | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-05-11 00:02:56 +0200 |
commit | f6635cb30a2d7bd1bfaaaa211bf0177e0ae5d750 (patch) | |
tree | 40292b402325bdf87ccdfdd721f07778894fa042 /src/client | |
parent | client/Client.cc: fix possible NULL pointer dereference (diff) | |
download | ceph-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/client')
-rw-r--r-- | src/client/SyntheticClient.cc | 5 |
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; |