From: Radoslaw Zarzynski Date: Tue, 13 Jun 2017 10:57:16 +0000 (+0200) Subject: rgw: fix error handling in get_params() of RGWPostObj_ObjStore_S3. X-Git-Tag: v12.1.1~164^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7cd7d37af672a2891196218138dedc92abb5034f;p=ceph.git rgw: fix error handling in get_params() of RGWPostObj_ObjStore_S3. 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 --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 0b2550d704b2..de248db470d3 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -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; }