Skip to contentSkip to conversation

linux-next: build warning after merge of the kspp tree

DISCUSSION Stephen Rothwell 3 participants 6 messages Aug 30, 2021 – Sep 6, 2021 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the kspp tree, today's linux-next build (powerpc allyesconfig) produced this warning:

drivers/gpu/drm/kmb/kmb_plane.c:135:20: warning: array subscript 3 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]

  135 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
   48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
      |                       ^~~~~~~~~~~~
drivers/gpu/drm/kmb/kmb_plane.c:132:20: warning: array subscript 2 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]
  132 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL1_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
   48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
      |                       ^~~~~~~~~~~~
drivers/gpu/drm/kmb/kmb_plane.c:129:20: warning: array subscript 1 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]
  129 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
   48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
      |                       ^~~~~~~~~~~~

Exposed by commit

656256c0d67c ("Makefile: Enable -Warray-bounds")

Introduced by commit

7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")

from v5.11-rc1.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 5 lines · Stephen Rothwell

Hi all,

After merging the kspp tree, today's linux-next build (powerpc allyesconfig) produced this warning:

Quoted 7 lines

drivers/gpu/drm/kmb/kmb_plane.c:135:20: warning: array subscript 3 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]

 135 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
     |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
  48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
     |                       ^~~~~~~~~~~~

Hi!

Ah yes, thanks for the report. I encountered this too, and have been told the warning will go away soon:
https://lore.kernel.org/lkml/BY5PR11MB4182ABD607EB99C1F68777928CC69@BY5PR11MB4182.namprd11.prod.outlook.com/

-Kees

#2 lore raw

Hi Kees,

Quoted 14 lines · On Mon, 30 Aug 2021 16:50:55 -0700 Kees Cook <[email protected]> wrote:
Quoted 11 lines · Stephen Rothwell

After merging the kspp tree, today's linux-next build (powerpc allyesconfig) produced this warning:

drivers/gpu/drm/kmb/kmb_plane.c:135:20: warning: array subscript 3 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]

 135 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
     |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
  48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
     |                       ^~~~~~~~~~~~  
Quoted 2 lines

Ah yes, thanks for the report. I encountered this too, and have been told the warning will go away soon:
https://lore.kernel.org/lkml/BY5PR11MB4182ABD607EB99C1F68777928CC69@BY5PR11MB4182.namprd11.prod.outlook.com/

ok, thanks

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
In reply to Stephen Rothwell

Hi all,

Quoted 28 lines · On Mon, 30 Aug 2021 18:44:29 +1000 Stephen Rothwell <[email protected]>…

After merging the kspp tree, today's linux-next build (powerpc allyesconfig) produced this warning:

drivers/gpu/drm/kmb/kmb_plane.c:135:20: warning: array subscript 3 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]

  135 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
   48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
      |                       ^~~~~~~~~~~~
drivers/gpu/drm/kmb/kmb_plane.c:132:20: warning: array subscript 2 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]
  132 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL1_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
   48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
      |                       ^~~~~~~~~~~~
drivers/gpu/drm/kmb/kmb_plane.c:129:20: warning: array subscript 1 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]
  129 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
   48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
      |                       ^~~~~~~~~~~~

Exposed by commit

Quoted 7 lines

656256c0d67c ("Makefile: Enable -Warray-bounds")

Introduced by commit

7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")

from v5.11-rc1.

Due to Linus -Werror, these are now errors :-(

I have reverted commit 656256c0d67c for now.

Signature · 2 lines
Cheers,
Stephen Rothwell
#4 lore raw
Quoted 35 lines · Stephen Rothwell

Hi all,

Quoted 32 lines · On Mon, 30 Aug 2021 18:44:29 +1000 Stephen Rothwell <[email protected]>…

After merging the kspp tree, today's linux-next build (powerpc allyesconfig) produced this warning:

drivers/gpu/drm/kmb/kmb_plane.c:135:20: warning: array subscript 3 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]

  135 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
   48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
      |                       ^~~~~~~~~~~~
drivers/gpu/drm/kmb/kmb_plane.c:132:20: warning: array subscript 2 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]
  132 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL1_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
   48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
      |                       ^~~~~~~~~~~~
drivers/gpu/drm/kmb/kmb_plane.c:129:20: warning: array subscript 1 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]
  129 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
drivers/gpu/drm/kmb/kmb_drv.h:48:23: note: while referencing 'plane_status'
   48 |  struct layer_status  plane_status[KMB_MAX_PLANES];
      |                       ^~~~~~~~~~~~

Exposed by commit

656256c0d67c ("Makefile: Enable -Warray-bounds")

Introduced by commit

Quoted 7 lines
Quoted 3 lines

7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")

from v5.11-rc1.

Due to Linus -Werror, these are now errors :-(

I have reverted commit 656256c0d67c for now.

I'm still surprised Linus added -Werror (it seems to go against years of his earlier mandates on not breaking the build). Seems like 3fe617ccafd6 should be reverted instead. ;)

Linus, warnings are being reported (as above), are you sure -Werror is the right way to go? (I can't believe I'm saying this, given my past desire to make various hardening failures break the build -- you convinced me to always warn instead, and it made good sense: a developer still gets binary results as well as any new warnings...)

-Kees

Signature · 1 line
Kees Cook
#5 lore raw
Quoted 2 lines · Kees Cook
Quoted 1 line

Linus, warnings are being reported (as above)

New warnings are apparently at least partly reported, but also clearly
(a) old warnings are ignored, and (b) new warnings seem to be very spottily fixed too.

Guenter reports "pass: 89 fail: 64" for his build setups.

So the fact that *I* require a clean build, and generally have two reject a couple of build requests every merge window because of that clearly doesn't mean that we actually have clean builds.

I've had that "no warnings" requirement for years. And that means that *my* build has been clean for years.

I want *all* builds to be clean, or at least as far as possible.

You should be the last to complain. You are literally the drop that broke the camel's back. I'm done being the last guard against build warnings.

Linus