On Wed, Sep 27, 2023 at 12:36 PM Paul Menzel <pmenzel@xxxxxxxxxxxxx> wrote: > > 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. Hi Paul I thought it exceeds the max character limit which is used for kernel patch rule. I'll change it back. > > > The subscrit is defined as int type. And it can be smaller than 0. > > subscript? yes > > > 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? I want to do this first. But the logic bellow indeed checks if the subscript is lower than 0. It's the reason I add -Wno-array-bounds. info->data_offset = be64_to_cpu(ddf->phys-> entries[info->disk.raid_disk]. config_size); info->component_size = ddf->dlist->size - info->data_offset; if (info->disk.raid_disk >= 0) pde = ddf->phys->entries + info->disk.raid_disk; Do you have any suggestions for this? Best Regards Xiao > > > 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 >