]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix error handling in get_params() of RGWPostObj_ObjStore_S3. 15670/head
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Tue, 13 Jun 2017 10:57:16 +0000 (12:57 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Tue, 13 Jun 2017 13:28:51 +0000 (15:28 +0200)
The recent Static Analysis for Ceph (linked 13 June 2017 on
ceph-devel) shows that the get_params method of RGWPostObj_ObjStore
assigns to a variable but doesn't use it later. The anomaly is
caused by lack of proper error handling. This commit rectifies it.

Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_rest_s3.cc

index 0b2550d704b2e0c0c8806af03b93c0ef6d395e89..de248db470d3e740277c9f1d7d306951eef9017e 100644 (file)
@@ -1578,7 +1578,7 @@ int RGWPostObj_ObjStore_S3::get_params()
     bool boundary;
     uint64_t chunk_size = s->cct->_conf->rgw_max_chunk_size;
     r = read_data(part.data, chunk_size, boundary, done);
-    if (!boundary) {
+    if (r < 0 || !boundary) {
       err_msg = "Couldn't find boundary";
       return -EINVAL;
     }
@@ -1768,7 +1768,7 @@ int RGWPostObj_ObjStore_S3::complete_get_params()
     bool boundary;
     uint64_t chunk_size = s->cct->_conf->rgw_max_chunk_size;
     r = read_data(part.data, chunk_size, boundary, done);
-    if (!boundary) {
+    if (r < 0 || !boundary) {
       return -EINVAL;
     }