]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client/SyntheticClient.cc: check return value of describe_layout()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 10 May 2013 15:43:03 +0000 (17:43 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 10 May 2013 22:02:56 +0000 (00:02 +0200)
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>
src/client/SyntheticClient.cc

index 7a2ab63a199831372c213ec4a5c3ead2d8591a27..fd2c6e57c3fe048e169ed029f13c5f6c08304394 100644 (file)
@@ -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;