grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/3] reed_solomon: Fix array subscript 0 is outside array bou


From: Paul Menzel
Subject: Re: [PATCH 3/3] reed_solomon: Fix array subscript 0 is outside array bounds
Date: Thu, 17 Mar 2022 08:41:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

Dear Michael,


Thank you for working on that.


Am 17.03.22 um 07:43 schrieb Michael Chang via Grub-devel:
The grub_absolute_pointer() is a compound expression that can only work
within a function. We are out of luck here when the pointer variables
require global definition due to ATTRIBUTE_TEXT that have to use fully
initialized global definition because of the way linkers work.

  static gf_single_t * const gf_powx ATTRIBUTE_TEXT = (void *) 0x100000;

For the reason given above, use gcc diagnostic pragmas to suppress the
array-bounds warning.

Can you please share the exact GCC warning messages?


Kind regards,

Paul


Signed-off-by: Michael Chang <mchang@suse.com>
---
  grub-core/lib/reed_solomon.c | 9 +++++++++
  1 file changed, 9 insertions(+)

diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c
index 82779a296b..562bd2e3e3 100644
--- a/grub-core/lib/reed_solomon.c
+++ b/grub-core/lib/reed_solomon.c
@@ -102,6 +102,11 @@ static gf_single_t errvals[256];
  static gf_single_t eqstat[65536 + 256];
  #endif
+#if __GNUC__ == 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+
  static gf_single_t
  gf_mul (gf_single_t a, gf_single_t b)
  {
@@ -319,6 +324,10 @@ decode_block (gf_single_t *ptr, grub_size_t s,
      }
  }
+#if __GNUC__ == 12
+#pragma GCC diagnostic pop
+#endif
+
  #if !defined (STANDALONE)
  static void
  encode_block (gf_single_t *ptr, grub_size_t s,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]