Re: [PATCH 3/4] mdadm: Avoid array bounds check of gcc

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

 



Dear Xiao,


Thank you for your patch.

Am 27.09.23 um 04:52 schrieb Xiao Ni:
With gcc version 13.2.1 20230918 (Red Hat 13.2.1-3) (GCC), it reports error:
super-ddf.c:1988:58: error: array subscript -1 is below array bounds of
‘struct phys_disk_entry[0]’ [-Werror=array-bounds=]

I wouldn’t wrap pasted lines.

The subscrit is defined as int type. And it can be smaller than 0.

subscript?

To avoid this error, add -Wno-array-bounds flag in Makefile.

Wouldn’t it be better to fix the error and not work around it by disabling the warning?


Kind regards,

Paul


Signed-off-by: Xiao Ni <xni@xxxxxxxxxx>
---
  Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5eac1a4e9690..47da883a9fb9 100644
--- a/Makefile
+++ b/Makefile
@@ -50,7 +50,7 @@ ifeq ($(origin CC),default)
  CC := $(CROSS_COMPILE)gcc
  endif
  CXFLAGS ?= -ggdb
-CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
+CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -Wno-array-bounds
  ifdef WARN_UNUSED
  CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
  endif



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux