summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVedansh Bhartia <vedanshbhartia@gmail.com>2023-06-07 19:32:40 +0200
committerVedansh Bhartia <vedanshbhartia@gmail.com>2023-06-07 19:32:40 +0200
commit1e5aa750f02ee88848b83dac3e034ee2622ddb6b (patch)
treee59c7682fb8e24aabbf34c568b9d267d2dcff500
parentMerge PR #47752 into main (diff)
downloadceph-1e5aa750f02ee88848b83dac3e034ee2622ddb6b.tar.xz
ceph-1e5aa750f02ee88848b83dac3e034ee2622ddb6b.zip
rgw: Add coverity annotations for resource leak false positives
Signed-off-by: Vedansh Bhartia <vedanshbhartia@gmail.com>
-rw-r--r--src/rgw/driver/rados/cls_fifo_legacy.h1
-rw-r--r--src/rgw/driver/rados/rgw_gc.cc1
-rw-r--r--src/rgw/rgw_aio_throttle.cc2
-rw-r--r--src/rgw/rgw_d3n_cacherequest.h1
-rw-r--r--src/rgw/rgw_kafka.cc1
-rw-r--r--src/rgw/rgw_kmip_client_impl.cc2
-rw-r--r--src/rgw/rgw_period_history.cc3
7 files changed, 11 insertions, 0 deletions
diff --git a/src/rgw/driver/rados/cls_fifo_legacy.h b/src/rgw/driver/rados/cls_fifo_legacy.h
index b0a68157e61..d0efe20a071 100644
--- a/src/rgw/driver/rados/cls_fifo_legacy.h
+++ b/src/rgw/driver/rados/cls_fifo_legacy.h
@@ -314,6 +314,7 @@ public:
&cb);
auto c = p->_cur;
p.release();
+ // coverity[RESOURCE_LEAK:FALSE]
return c;
}
static void complete(Ptr&& p, int r) {
diff --git a/src/rgw/driver/rados/rgw_gc.cc b/src/rgw/driver/rados/rgw_gc.cc
index bd16bde1bd5..850b9ed72e3 100644
--- a/src/rgw/driver/rados/rgw_gc.cc
+++ b/src/rgw/driver/rados/rgw_gc.cc
@@ -214,6 +214,7 @@ int RGWGC::async_defer_chain(const string& tag, const cls_rgw_obj_chain& chain)
int ret = store->gc_aio_operate(obj_names[i], state->completion, &op);
if (ret == 0) {
+ // coverity[RESOURCE_LEAK:FALSE]
state.release(); // release ownership until async_defer_callback()
}
return ret;
diff --git a/src/rgw/rgw_aio_throttle.cc b/src/rgw/rgw_aio_throttle.cc
index 91f8202a08e..59f006c07e6 100644
--- a/src/rgw/rgw_aio_throttle.cc
+++ b/src/rgw/rgw_aio_throttle.cc
@@ -57,6 +57,7 @@ AioResultList BlockingAioThrottle::get(rgw_raw_obj obj,
std::move(f)(this, *static_cast<AioResult*>(p.get()));
lock.lock();
}
+ // coverity[RESOURCE_LEAK:FALSE]
p.release();
return std::move(completed);
}
@@ -146,6 +147,7 @@ AioResultList YieldingAioThrottle::get(rgw_raw_obj obj,
pending.push_back(*p);
std::move(f)(this, *static_cast<AioResult*>(p.get()));
}
+ // coverity[RESOURCE_LEAK:FALSE]
p.release();
return std::move(completed);
}
diff --git a/src/rgw/rgw_d3n_cacherequest.h b/src/rgw/rgw_d3n_cacherequest.h
index d58359c5e84..48fdbe168bb 100644
--- a/src/rgw/rgw_d3n_cacherequest.h
+++ b/src/rgw/rgw_d3n_cacherequest.h
@@ -114,6 +114,7 @@ struct D3nL1CacheRequest {
auto ec = boost::system::error_code{-ret, boost::system::system_category()};
ceph::async::post(std::move(p), ec, bufferlist{});
} else {
+ // coverity[RESOURCE_LEAK:FALSE]
(void)p.release();
}
return init.result.get();
diff --git a/src/rgw/rgw_kafka.cc b/src/rgw/rgw_kafka.cc
index 163b242d5c0..1716edd0c71 100644
--- a/src/rgw/rgw_kafka.cc
+++ b/src/rgw/rgw_kafka.cc
@@ -449,6 +449,7 @@ private:
} else {
ldout(conn->cct, 20) << "Kafka publish (no callback): OK" << dendl;
}
+ // coverity[RESOURCE_LEAK:FALSE]
}
// the managers thread:
diff --git a/src/rgw/rgw_kmip_client_impl.cc b/src/rgw/rgw_kmip_client_impl.cc
index 0824273e64e..a8f9dbac055 100644
--- a/src/rgw/rgw_kmip_client_impl.cc
+++ b/src/rgw/rgw_kmip_client_impl.cc
@@ -418,6 +418,8 @@ RGWKMIPManagerImpl::add_request(RGWKMIPTransceiver *req)
std::unique_lock l{lock};
if (going_down)
return -ECANCELED;
+ // requests is a boost::intrusive::list, which manages pointers and does not copy the instance
+ // coverity[RESOURCE_LEAK:FALSE]
requests.push_back(*new Request{*req});
l.unlock();
if (worker)
diff --git a/src/rgw/rgw_period_history.cc b/src/rgw/rgw_period_history.cc
index abbd998cfb9..70750368f37 100644
--- a/src/rgw/rgw_period_history.cc
+++ b/src/rgw/rgw_period_history.cc
@@ -133,6 +133,7 @@ RGWPeriodHistory::Impl::Impl(CephContext* cct, Puller* puller,
history->periods.push_back(current_period);
// insert as our current history
+ // coverity[RESOURCE_LEAK:FALSE]
current_history = histories.insert(*history).first;
// get a cursor to the current period
@@ -245,6 +246,7 @@ Cursor RGWPeriodHistory::Impl::insert_locked(RGWPeriod&& period)
// create a new history for this period
auto history = new History;
history->periods.emplace_back(std::move(period));
+ // coverity[RESOURCE_LEAK:FALSE]
histories.insert(last, *history);
i = Set::s_iterator_to(*history);
@@ -294,6 +296,7 @@ Cursor RGWPeriodHistory::Impl::insert_locked(RGWPeriod&& period)
// create a new history for this period
auto history = new History;
history->periods.emplace_back(std::move(period));
+ // coverity[RESOURCE_LEAK:FALSE]
histories.insert(i, *history);
i = Set::s_iterator_to(*history);