]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
phonet: fix building with clang
authorArnd Bergmann <arnd@arndb.de>
Tue, 19 Feb 2019 21:53:50 +0000 (22:53 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit57d2c43e070c86f7d21259c60798747bcdd02de7
treefd10fb1dfe62ff750b5085704ab892dc031e07cd
parentb96bfe0c908e2a9f4fa4a5462ec39ce7b63a81c8
phonet: fix building with clang

BugLink: https://bugs.launchpad.net/bugs/1837952
[ Upstream commit 6321aa197547da397753757bd84c6ce64b3e3d89 ]

clang warns about overflowing the data[] member in the struct pnpipehdr:

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];

Using a flexible array member at the end of the struct avoids the
warning, but since we cannot have a flexible array member inside
of the union, each index now has to be moved back by one, which
makes it a little uglier.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: RĂ©mi Denis-Courmont <remi@remlab.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/net/phonet/pep.h
net/phonet/pep.c