Project

General

Profile

Actions

Bug #13628

closed

sppptun: array subscript 0 is outside array bounds

Added by Toomas Soome about 2 months ago. Updated 29 days 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:

    In file included from ../../common/io/ppp/sppptun/sppptun.c:56:
    ../../common/io/ppp/sppptun/sppptun.c: In function 'sppptun_close':
    ../../common/io/ppp/sppptun/sppptun_impl.h:153:3: error: array subscript 0 is outside array bounds of 'struct
    qelem[1]' [-Werror=array-bounds]
      153 |  ((tunll_t *)((caddr_t)(p) - offsetof(tunll_t, tll_next)))
          |  ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/io/ppp/sppptun/sppptun.c:681:17: note: in expansion of macro 'TO_TLL'
      681 |   while (tll != TO_TLL(&tunll_list)) {
          |                 ^~~~~~
    ../../common/io/ppp/sppptun/sppptun.c:149:21: note: while referencing 'tunll_list'
      149 | static struct qelem tunll_list;
          |                     ^~~~~~~~~~
    In file included from ../../common/io/ppp/sppptun/sppptun.c:56:
    ../../common/io/ppp/sppptun/sppptun.c: In function 'tll_lookup_on_name':
    ../../common/io/ppp/sppptun/sppptun_impl.h:153:3: error: array subscript 0 is outside array bounds of 'struct
    qelem[1]' [-Werror=array-bounds]
      153 |  ((tunll_t *)((caddr_t)(p) - offsetof(tunll_t, tll_next)))
          |  ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/io/ppp/sppptun/sppptun.c:1088:16: note: in expansion of macro 'TO_TLL'
     1088 |  for (; tll != TO_TLL(&tunll_list); tll = TO_TLL(tll->tll_next))
          |                ^~~~~~
    ../../common/io/ppp/sppptun/sppptun.c:149:21: note: while referencing 'tunll_list'
      149 | static struct qelem tunll_list;
          |                     ^~~~~~~~~~
    In file included from ../../common/io/ppp/sppptun/sppptun.c:56:
    ../../common/io/ppp/sppptun/sppptun.c: In function 'sppptun_inner_ioctl':
    ../../common/io/ppp/sppptun/sppptun_impl.h:153:3: error: array subscript 0 is outside array bounds of 'struct
    qelem[1]' [-Werror=array-bounds]
      153 |  ((tunll_t *)((caddr_t)(p) - offsetof(tunll_t, tll_next)))
          |  ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/io/ppp/sppptun/sppptun.c:1250:17: note: in expansion of macro 'TO_TLL'
     1250 |   while (tll != TO_TLL(&tunll_list)) {
          |                 ^~~~~~
    ../../common/io/ppp/sppptun/sppptun.c:149:21: note: while referencing 'tunll_list'
      149 | static struct qelem tunll_list;
          |                     ^~~~~~~~~~
    In file included from ../../common/io/ppp/sppptun/sppptun.c:56:
    ../../common/io/ppp/sppptun/sppptun_impl.h:153:3: error: array subscript 0 is outside array bounds of 'struct
    qelem[1]' [-Werror=array-bounds]
      153 |  ((tunll_t *)((caddr_t)(p) - offsetof(tunll_t, tll_next)))
          |  ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/io/ppp/sppptun/sppptun.c:1255:14: note: in expansion of macro 'TO_TLL'
     1255 |   if (tll != TO_TLL(&tunll_list)) {
          |              ^~~~~~
    ../../common/io/ppp/sppptun/sppptun.c:149:21: note: while referencing 'tunll_list'
      149 | static struct qelem tunll_list;
          |                     ^~~~~~~~~~
    cc1: all warnings being treated as errors

Replace caddr_t with uintptr_t.

Testing done: build/install/boot.

wsdiff with master:

Changed objects: 
/code/illumos-gate/usr/src/uts/intel/sppptun/obj64/sppptun.o
NOTE: ELF .text difference detected.

1826c1826
<     sppptun_inner_ioctl+0x5d4: 48 39 d0           cmpq   %rdx,%rax
---
>     sppptun_inner_ioctl+0x5d4: 48 39 c2           cmpq   %rax,%rdx
1832c1832
<     sppptun_inner_ioctl+0x5e8: 48 39 d0           cmpq   %rdx,%rax
---
>     sppptun_inner_ioctl+0x5e8: 48 39 c2           cmpq   %rax,%rdx

/code/illumos-gate/usr/src/uts/intel/sppptun/obj64/sppptun
NOTE: ELF .text difference detected.

1826c1826
<     sppptun_inner_ioctl+0x5d4: 48 39 d0           cmpq   %rdx,%rax
---
>     sppptun_inner_ioctl+0x5d4: 48 39 c2           cmpq   %rax,%rdx
1832c1832
<     sppptun_inner_ioctl+0x5e8: 48 39 d0           cmpq   %rdx,%rax
---
>     sppptun_inner_ioctl+0x5e8: 48 39 c2           cmpq   %rax,%rdx

Actions #1

Updated by Electric Monk about 2 months ago

  • Gerrit CR set to 1328
Actions #2

Updated by Electric Monk 29 days ago

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

git commit 8f097fe6cf8dff8db1e1c43d349b305633044d40

commit  8f097fe6cf8dff8db1e1c43d349b305633044d40
Author: Toomas Soome <tsoome@me.com>
Date:   2021-04-07T17:30:52.000Z

    13628 sppptun: array subscript 0 is outside array bounds
    Reviewed by: Yuri Pankov <yuripv@yuripv.dev>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

Actions

Also available in: Atom PDF