[gigaboot] Fix const-safety issue in fbl::Vector iterator usage.

Bug: 128479
Change-Id: I258b9bf2fc05937c7891ac14ee68cc1eba6576e7
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/865876
Reviewed-by: Yecheng Zhao <zyecheng@google.com>
Commit-Queue: Victor Costan <costan@google.com>
Fuchsia-Auto-Submit: Victor Costan <costan@google.com>
diff --git a/src/firmware/gigaboot/cpp/gpt.cc b/src/firmware/gigaboot/cpp/gpt.cc
index e25a7d2..a9e052d 100644
--- a/src/firmware/gigaboot/cpp/gpt.cc
+++ b/src/firmware/gigaboot/cpp/gpt.cc
@@ -387,7 +387,8 @@
   return fit::ok();
 }
 
-cpp20::span<std::array<char, GPT_NAME_LEN / 2>> EfiGptBlockDevice::ListPartitionNames() const {
+cpp20::span<const std::array<char, GPT_NAME_LEN / 2>> EfiGptBlockDevice::ListPartitionNames()
+    const {
   auto last_partition = std::find_if(utf8_names_.begin(), utf8_names_.end(),
                                      [](const auto &p) { return p.front() == '\0'; });
   return cpp20::span(utf8_names_.begin(), last_partition);
diff --git a/src/firmware/gigaboot/cpp/gpt.h b/src/firmware/gigaboot/cpp/gpt.h
index a12163c..2a52425 100644
--- a/src/firmware/gigaboot/cpp/gpt.h
+++ b/src/firmware/gigaboot/cpp/gpt.h
@@ -37,7 +37,7 @@
                                          size_t length);
 
   gpt_header_t const &GptHeader() const { return gpt_header_; }
-  cpp20::span<std::array<char, GPT_NAME_LEN / 2>> ListPartitionNames() const;
+  cpp20::span<const std::array<char, GPT_NAME_LEN / 2>> ListPartitionNames() const;
 
   size_t BlockSize() { return block_io_protocol_->Media->BlockSize; }
   uint64_t LastBlock() { return block_io_protocol_->Media->LastBlock; }
diff --git a/src/firmware/gigaboot/cpp/tests/efi_variables_test.cc b/src/firmware/gigaboot/cpp/tests/efi_variables_test.cc
index 3dc1826..a8979bf 100644
--- a/src/firmware/gigaboot/cpp/tests/efi_variables_test.cc
+++ b/src/firmware/gigaboot/cpp/tests/efi_variables_test.cc
@@ -194,8 +194,8 @@
 
 // Helper function to work around matching `fbl::Vector`
 // Alternative is to add `using value_type = T;` to `fbl::Vector` class;
-cpp20::span<uint8_t> ToSpan(const efi::VariableValue& value) {
-  return cpp20::span<uint8_t>(value.begin(), value.end());
+cpp20::span<const uint8_t> ToSpan(const efi::VariableValue& value) {
+  return cpp20::span<const uint8_t>(value.begin(), value.end());
 }
 
 TEST_F(EfiVariablesStubTest, GetVariableGood) {