From cfeed8c0d234262482da664cf9934d892b483923 Mon Sep 17 00:00:00 2001 From: Dattaprasad Govekar <65955475+DPG17@users.noreply.github.com> Date: Mon, 21 Mar 2022 15:36:32 +0530 Subject: [PATCH] rgw_sal_motr: [CORTX-29221] Fix corner/negative cases in Multipart ListParts API (#127) The changes will make ListParts API more robust. Signed-off-by: Dattaprasad Govekar --- src/rgw/rgw_sal_motr.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_sal_motr.cc b/src/rgw/rgw_sal_motr.cc index 1cb8da54b54cd..c19804a6888e3 100644 --- a/src/rgw/rgw_sal_motr.cc +++ b/src/rgw/rgw_sal_motr.cc @@ -2675,7 +2675,10 @@ int MotrMultipartUpload::list_parts(const DoutPrefixProvider *dpp, CephContext * int *next_marker, bool *truncated, bool assume_unsorted) { - int rc; + int rc = 0; + if (num_parts <= 0 or marker < 0) + return rc; + vector key_vec(num_parts); vector val_vec(num_parts);