Project

General

Profile

Actions

Bug #13409

closed

cxgbe: replace zero sized array by flexible array

Added by Toomas Soome 5 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
driver - device drivers
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

Build errors with gcc 10:

    ../../../common/io/cxgbe/t4nex/t4_sge.c:2627:18: error: array subscript 127 is outside the bounds of an interior zero-length array 'struct ulptx_sge_pair[0]' [-Werror=zero-length-bounds]
     2627 |   txinfo->sgl.sge[idx / 2].len[idx & 1] = cpu_to_be32(len);
          |   ~~~~~~~~~~~~~~~^~~~~~~~~
    In file included from ../../../common/io/cxgbe/t4nex/t4_sge.c:37:
    ../../../common/io/cxgbe/common/t4_msg.h:2772:24: note: while referencing 'sge'
     2772 |  struct ulptx_sge_pair sge[0];
          |                        ^~~
    ../../../common/io/cxgbe/t4nex/t4_sge.c:2628:18: error: array subscript 127 is outside the bounds of an interior zero-length array 'struct ulptx_sge_pair[0]' [-Werror=zero-length-bounds]
     2628 |   txinfo->sgl.sge[idx / 2].addr[idx & 1] = cpu_to_be64(ba);
          |   ~~~~~~~~~~~~~~~^~~~~~~~~
    In file included from ../../../common/io/cxgbe/t4nex/t4_sge.c:37:
    ../../../common/io/cxgbe/common/t4_msg.h:2772:24: note: while referencing 'sge'
     2772 |  struct ulptx_sge_pair sge[0];
          |                        ^~~
    ../../../common/io/cxgbe/t4nex/t4_sge.c:2627:18: error: array subscript 127 is outside the bounds of an interior zero-length array 'struct ulptx_sge_pair[0]' [-Werror=zero-length-bounds]
     2627 |   txinfo->sgl.sge[idx / 2].len[idx & 1] = cpu_to_be32(len);
          |   ~~~~~~~~~~~~~~~^~~~~~~~~
    In file included from ../../../common/io/cxgbe/t4nex/t4_sge.c:37:
    ../../../common/io/cxgbe/common/t4_msg.h:2772:24: note: while referencing 'sge'
     2772 |  struct ulptx_sge_pair sge[0];
          |                        ^~~
    ../../../common/io/cxgbe/t4nex/t4_sge.c:2628:18: error: array subscript 127 is outside the bounds of an interior zero-length array 'struct ulptx_sge_pair[0]' [-Werror=zero-length-bounds]
     2628 |   txinfo->sgl.sge[idx / 2].addr[idx & 1] = cpu_to_be64(ba);
          |   ~~~~~~~~~~~~~~~^~~~~~~~~
    In file included from ../../../common/io/cxgbe/t4nex/t4_sge.c:37:
    ../../../common/io/cxgbe/common/t4_msg.h:2772:24: note: while referencing 'sge'
     2772 |  struct ulptx_sge_pair sge[0];
          |                        ^~~
    ../../../common/io/cxgbe/t4nex/t4_sge.c:2627:18: error: array subscript 127 is outside the bounds of an interior zero-length array 'struct ulptx_sge_pair[0]' [-Werror=zero-length-bounds]
     2627 |   txinfo->sgl.sge[idx / 2].len[idx & 1] = cpu_to_be32(len);
          |   ~~~~~~~~~~~~~~~^~~~~~~~~
    In file included from ../../../common/io/cxgbe/t4nex/t4_sge.c:37:
    ../../../common/io/cxgbe/common/t4_msg.h:2772:24: note: while referencing 'sge'
     2772 |  struct ulptx_sge_pair sge[0];
          |                        ^~~
    ../../../common/io/cxgbe/t4nex/t4_sge.c:2628:18: error: array subscript 127 is outside the bounds of an interior zero-length array 'struct ulptx_sge_pair[0]' [-Werror=zero-length-bounds]
     2628 |   txinfo->sgl.sge[idx / 2].addr[idx & 1] = cpu_to_be64(ba);
          |   ~~~~~~~~~~~~~~~^~~~~~~~~
    In file included from ../../../common/io/cxgbe/t4nex/t4_sge.c:37:
    ../../../common/io/cxgbe/common/t4_msg.h:2772:24: note: while referencing 'sge'
     2772 |  struct ulptx_sge_pair sge[0];
          |                        ^~~
    ../../../common/io/cxgbe/t4nex/t4_sge.c:2627:18: error: array subscript 127 is outside the bounds of an interior zero-length array 'struct ulptx_sge_pair[0]' [-Werror=zero-length-bounds]
     2627 |   txinfo->sgl.sge[idx / 2].len[idx & 1] = cpu_to_be32(len);
          |   ~~~~~~~~~~~~~~~^~~~~~~~~
    In file included from ../../../common/io/cxgbe/t4nex/t4_sge.c:37:
    ../../../common/io/cxgbe/common/t4_msg.h:2772:24: note: while referencing 'sge'
     2772 |  struct ulptx_sge_pair sge[0];
          |                        ^~~
    ../../../common/io/cxgbe/t4nex/t4_sge.c:2628:18: error: array subscript 127 is outside the bounds of an interior zero-length array 'struct ulptx_sge_pair[0]' [-Werror=zero-length-bounds]
     2628 |   txinfo->sgl.sge[idx / 2].addr[idx & 1] = cpu_to_be64(ba);
          |   ~~~~~~~~~~~~~~~^~~~~~~~~
    In file included from ../../../common/io/cxgbe/t4nex/t4_sge.c:37:
    ../../../common/io/cxgbe/common/t4_msg.h:2772:24: note: while referencing 'sge'
     2772 |  struct ulptx_sge_pair sge[0];
          |                        ^~~
    ../../../common/io/cxgbe/t4nex/t4_sge.c:2552:18: error: array subscript 2147483647 is outside the bounds of an interior zero-length array 'struct ulptx_sge_pair[0]' [-Werror=zero-length-bounds]
     2552 |   txinfo->sgl.sge[n / 2].len[1] = cpu_to_be32(0);
          |   ~~~~~~~~~~~~~~~^~~~~~~
    In file included from ../../../common/io/cxgbe/t4nex/t4_sge.c:37:
    ../../../common/io/cxgbe/common/t4_msg.h:2772:24: note: while referencing 'sge'
     2772 |  struct ulptx_sge_pair sge[0];
          |                        ^~~
    cc1: all warnings being treated as errors
    *** Error code 1
    dmake: Warning: Command failed for target `obj64/t4_sge.o'
    Current working directory /code/illumos-gate/usr/src/uts/intel/cxgbe/t4nex

Testing done: build/install/boot, however, I do not have the card.

Actions #1

Updated by Electric Monk 5 months ago

  • Gerrit CR set to 1132
Actions #2

Updated by Toomas Soome 5 months ago

  • Description updated (diff)
Actions #3

Updated by Toomas Soome 5 months ago

  • Description updated (diff)
Actions #4

Updated by Electric Monk 4 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit ab2fdd80a620c2b88e5ac2c4247ab79880761b18

commit  ab2fdd80a620c2b88e5ac2c4247ab79880761b18
Author: Toomas Soome <tsoome@me.com>
Date:   2021-01-08T16:37:36.000Z

    13409 cxgbe: replace zero sized array by flexible array
    Reviewed by: Robert Mustacchi <rm@fingolfin.org>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

Actions

Also available in: Atom PDF