Re: [PATCH 13/13] flex-array: warn when a flexible array member has some padding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 01, 2020 at 09:41:21PM +0200, Luc Van Oostenryck wrote:
> On Thu, Oct 01, 2020 at 12:27:56PM -0700, Linus Torvalds wrote:
> > On Thu, Oct 1, 2020 at 12:17 PM Luc Van Oostenryck
> > <luc.vanoostenryck@xxxxxxxxx> wrote:
> > >
> > > > So in the kernel, we would
> > > >
> > > >  - start warning about 'sizeof(flex_struct)'
> > >
> > > Adding this warning by default annoys me slightly because it will
> > > add 5700+ warnings to the 18000 already present and I think sparse
> > > is already underused because it is very/too noisy. But I guess that
> > > most occurrences come from a few macros and thus should be easy to
> > > get rid off.
> > 
> > Hopefully. I'll try to take a look. Do you have the sparse changes in
> > a git branch already so that I can just try that directly?
> 
> What I posted yesterday is on
> 	git://git.kernel.org/pub/scm/devel/sparse/sparse-dev.git flex-array
> 
> > Or if you send me a couple of examples, maybe it's just the same
> > pattern over and over,..
> 
> Well, the 888 occurences I see are already 'unique' occurences
> (in the sense that the warning is from a distinct file+position).
> I'm adding in attachment the extract of my test logs (but it is
> on v5.9-rc1 so it's maybe not much usefull). I ddn't investigated
> anything, just checked a few case to see that it was a genuine
> occurrence.

Sorry, I was thinking about the nested ones and sent the wrong.
Here are the top entries for sizeof():
     66 ./include/linux/filter.h:752:16: warning: using sizeof on a flexible structure
     48 crypto/gcm.c:547:17: warning: using sizeof on a flexible structure
     48 crypto/authencesn.c:357:17: warning: using sizeof on a flexible structure
     48 crypto/authenc.c:339:17: warning: using sizeof on a flexible structure
     44 ./include/linux/ihex.h:26:38: warning: using sizeof on a flexible structure
     30 drivers/crypto/chelsio/chcr_algo.c:793:32: warning: using sizeof on a flexible structure
     29 ./include/crypto/skcipher.h:518:31: warning: using sizeof on a flexible structure
     27 ./include/linux/can/dev.h:100:13: warning: using sizeof on a flexible structure
     24 net/mac80211/tdls.c:874:32: warning: using sizeof on a flexible structure
     24 net/ipv6/ndisc.c:1662:18: warning: using sizeof on a flexible structure
     24 drivers/tty/tty_buffer.c:352:28: warning: using sizeof on a flexible structure
     24 drivers/tty/tty_buffer.c:316:28: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:972:25: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:968:32: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:961:29: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:905:25: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:897:29: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:760:49: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:756:55: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:747:62: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:738:49: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:729:53: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:577:33: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:559:39: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:554:41: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:404:29: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:1134:33: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:1118:55: warning: using sizeof on a flexible structure
     23 net/netfilter/ipset/ip_set_hash_gen.h:1114:51: warning: using sizeof on a flexible structure
     20 fs/proc/inode.c:110:9: warning: using sizeof on a flexible structure
     20 fs/proc/inode.c:109:17: warning: using sizeof on a flexible structure
     20 fs/proc/generic.c:425:29: warning: using sizeof on a flexible structure
     18 net/ipv4/tcp_output.c:1241:28: warning: using sizeof on a flexible structure
     18 net/core/net-sysfs.c:769:23: warning: using sizeof on a flexible structure
     17 ./include/linux/ihex.h:52:50: warning: using sizeof on a flexible structure
     16 fs/proc/inode.c:107:35: warning: using sizeof on a flexible structure
     16 ./include/crypto/skcipher.h:496:23: warning: using sizeof on a flexible structure
     15 mm/percpu.c:2259:21: warning: using sizeof on a flexible structure
     14 drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h:281:27: warning: using sizeof on a flexible structure
     13 drivers/net/wireguard/messages.h:117:34: warning: using sizeof on a flexible structure
     13 ./include/crypto/hash.h:594:23: warning: using sizeof on a flexible structure
     12 net/netfilter/x_tables.c:780:21: warning: using sizeof on a flexible structure
     12 net/netfilter/x_tables.c:1157:21: warning: using sizeof on a flexible structure
     12 net/netfilter/ipset/ip_set_hash_gen.h:143:51: warning: using sizeof on a flexible structure
     12 net/netfilter/ipset/ip_set_hash_gen.h:139:29: warning: using sizeof on a flexible structure
     12 net/mac80211/iface.c:1829:28: warning: using sizeof on a flexible structure
     12 net/core/skbuff.c:6188:26: warning: using sizeof on a flexible structure
     12 net/core/skbuff.c:6146:39: warning: using sizeof on a flexible structure
     12 net/core/skbuff.c:4214:16: warning: using sizeof on a flexible structure
     12 net/core/bpf_sk_storage.c:666:32: warning: using sizeof on a flexible structure
     12 net/core/bpf_sk_storage.c:1081:9: warning: using sizeof on a flexible structure
     12 kernel/module.c:1601:19: warning: using sizeof on a flexible structure
     12 kernel/bpf/core.c:881:16: warning: using sizeof on a flexible structure
     12 drivers/staging/greybus/sdio.c:136:20: warning: using sizeof on a flexible structure
     12 drivers/infiniband/hw/cxgb4/provider.c:278:31: warning: using sizeof on a flexible structure
     12 drivers/gpu/drm/drm_managed.c:92:13: warning: using sizeof on a flexible structure
     12 drivers/crypto/picoxcell_crypto.c:711:17: warning: using sizeof on a flexible structure
     12 crypto/cmac.c:271:17: warning: using sizeof on a flexible structure
     12 crypto/cmac.c:266:17: warning: using sizeof on a flexible structure
     12 crypto/chacha20poly1305.c:528:17: warning: using sizeof on a flexible structure
     12 crypto/adiantum.c:429:23: warning: using sizeof on a flexible structure
     11 ./include/uapi/linux/bcache.h:101:17: warning: using sizeof on a flexible structure
     11 ./include/crypto/aead.h:414:23: warning: using sizeof on a flexible structure
     10 drivers/infiniband/sw/rxe/rxe.h:76:9: warning: using sizeof on a flexible structure
     10 drivers/base/devres.c:95:13: warning: using sizeof on a flexible structure
     10 ./include/rdma/rdmavt_qp.h:535:39: warning: using sizeof on a flexible structure
     10 ./include/rdma/ib_verbs.h:583:25: warning: using sizeof on a flexible structure
     10 ./include/crypto/hash.h:990:26: warning: using sizeof on a flexible structure
     10 ./include/crypto/akcipher.h:196:23: warning: using sizeof on a flexible structure

Less frequent ones removed. There is a lot with a single occurence
mostly in drivers/.


-- Luc




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux