lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 7 Jan 2019 19:54:20 -0700
From:   Nathan Chancellor <natechancellor@...il.com>
To:     Remi Denis-Courmont <courmisch@...il.com>,
        "David S. Miller" <davem@...emloft.net>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Clang warnings in net/phonet

Hi all,

When building the kernel with Clang, this warning comes up in net/phonet.

net/phonet/pep.c:224:16: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
        ph->data[0] = oph->data[1]; /* CTRL id */
                      ^         ~
include/net/phonet/pep.h:66:3: note: array 'data' declared here
                u8              data[1];
                ^
net/phonet/pep.c:281:10: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
        switch (hdr->data[1]) {
                ^         ~
include/net/phonet/pep.h:66:3: note: array 'data' declared here
                u8              data[1];
                ^
net/phonet/pep.c:285:12: warning: array index 4 is past the end of the array (which contains 1 element) [-Warray-bounds]
                        switch (hdr->data[4]) {
                                ^         ~
include/net/phonet/pep.h:66:3: note: array 'data' declared here
                u8              data[1];
                ^
net/phonet/pep.c:295:8: warning: array index 4 is past the end of the array (which contains 1 element) [-Warray-bounds]
                        if (hdr->data[4] == PEP_IND_READY)
                            ^         ~
include/net/phonet/pep.h:66:3: note: array 'data' declared here
                u8              data[1];
                ^
net/phonet/pep.c:304:21: warning: array index 4 is past the end of the array (which contains 1 element) [-Warray-bounds]
                atomic_add(wake = hdr->data[4], &pn->tx_credits);
                                  ^         ~
include/net/phonet/pep.h:66:3: note: array 'data' declared here
                u8              data[1];
                ^
net/phonet/pep.c:509:9: warning: array index 4 is past the end of the array (which contains 1 element) [-Warray-bounds]
        n_sb = hdr->data[4];
               ^         ~
include/net/phonet/pep.h:66:3: note: array 'data' declared here
                u8              data[1];
                ^
net/phonet/pep.c:817:14: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
        peer_type = hdr->other_pep_type << 8;
                    ^    ~~~~~~~~~~~~~~
include/net/phonet/pep.h:66:3: note: array 'data' declared here
                u8              data[1];
                ^
net/phonet/pep.c:820:9: warning: array index 4 is past the end of the array (which contains 1 element) [-Warray-bounds]
        n_sb = hdr->data[4];
               ^         ~
include/net/phonet/pep.h:66:3: note: array 'data' declared here
                u8              data[1];
                ^
8 warnings generated.

I have taken a look at the effected code but I can't really figure out
the proper fix for this warning (my knowledge of C just isn't there
yet). Nick had suggested changing 'u8 data[1]' to 'u8 *data' in
'struct pnpipehdr', which seems logical but I can't say for sure. Any
advice would be appreciated :)

Thanks,
Nathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ