From: Adam C. Emerson Date: Tue, 24 Mar 2026 22:19:14 +0000 (-0400) Subject: rgw/ssd: Use `boost::small_vector` in place of VLAs X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2c693bf4f4d912b6522572ae565c0a9ad412671a;p=ceph.git rgw/ssd: Use `boost::small_vector` in place of VLAs Signed-off-by: Adam C. Emerson --- diff --git a/src/rgw/rgw_ssd_driver.cc b/src/rgw/rgw_ssd_driver.cc index fc11f8302186..d33d51eb0746 100644 --- a/src/rgw/rgw_ssd_driver.cc +++ b/src/rgw/rgw_ssd_driver.cc @@ -1,4 +1,7 @@ #include + +#include + #include "common/async/completion.h" #include "common/errno.h" #include "common/async/blocked_completion.h" @@ -405,7 +408,7 @@ int SSDDriver::put(const DoutPrefixProvider* dpp, const std::string& key, const int SSDDriver::get(const DoutPrefixProvider* dpp, const std::string& key, off_t offset, uint64_t len, bufferlist& bl, rgw::sal::Attrs& attrs, optional_yield y) { - char buffer[len]; + boost::container::small_vector buffer(len); std::string location = create_dirs_get_filepath_from_key(dpp, partition_info.location, key); ldpp_dout(dpp, 20) << __func__ << "(): location=" << location << dendl; FILE *cache_file = nullptr; @@ -420,7 +423,7 @@ int SSDDriver::get(const DoutPrefixProvider* dpp, const std::string& key, off_t fseek(cache_file, offset, SEEK_SET); - nbytes = fread(buffer, 1, len, cache_file); + nbytes = fread(buffer.data(), 1, len, cache_file); if (nbytes != len) { fclose(cache_file); ldpp_dout(dpp, 0) << "ERROR: get::io_read: fread has returned error: nbytes!=len, nbytes=" << nbytes << ", len=" << len << dendl; @@ -433,7 +436,7 @@ int SSDDriver::get(const DoutPrefixProvider* dpp, const std::string& key, off_t return -errno; } - bl.append(buffer, len); + bl.append(buffer.data(), len); r = get_attrs(dpp, key, attrs, y); if (r < 0) {