]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/ssd: Use `boost::small_vector` in place of VLAs
authorAdam C. Emerson <aemerson@redhat.com>
Tue, 24 Mar 2026 22:19:14 +0000 (18:19 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 26 Mar 2026 04:07:20 +0000 (00:07 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_ssd_driver.cc

index fc11f8302186797b0f52f0b0ec1de328ee7e61c5..d33d51eb0746861b5169cb369bb2a7abec4bb874 100644 (file)
@@ -1,4 +1,7 @@
 #include <boost/asio/system_executor.hpp>
+
+#include <boost/container/small_vector.hpp>
+
 #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<char, 1024> 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) {