Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1725454
| From | Thomas Meyer <thomas@m3y3r.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] ipv6: sr: Use ARRAY_SIZE macro |
| Date | 2017-09-02 08:30 +0200 |
| Message-ID | <ula6m-7Sd-5@gated-at.bofh.it> (permalink) |
| References | <ukyu5-6Gt-13@gated-at.bofh.it> <ul5zH-4K7-7@gated-at.bofh.it> <ul7Lb-6dr-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Sep 01, 2017 at 08:51:55PM -0700, Joe Perches wrote:
> On Fri, 2017-09-01 at 18:35 -0700, David Miller wrote:
> > From: Thomas Meyer <thomas@m3y3r.de>
> > Date: Thu, 31 Aug 2017 16:18:15 +0200
> >
> > > Grepping for "sizeof\(.+\) / sizeof\(" found this as one of the first
> > > candidates.
> > > Maybe a coccinelle can catch all of those.
>
Hi,
> Umm: try scripts/coccinelle/misc/array_size.cocci
Yes, I found out/remembered after I submitted above patch... I used to
run most of the cocci spatches (some just run too long) after each rc1 release, but lost interest/time. nobody seems to
do this regularly, at least for existing spatches.
See 6 patches with Message-ID 20170901212907.5662-1-thomas@m3y3r.de
> Until then, maybe a perl script?
>
> $ git grep --name-only sizeof.*/.*sizeof drivers/net | \
> xargs perl -p -i -e 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\/\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)/ARRAY_SIZE(\1)/g'
>
> gives:
>
> $ git diff --stat drivers/net
> drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 2 +-
> drivers/net/ethernet/mellanox/mlx4/fw.c | 4 +--
> drivers/net/ethernet/mellanox/mlx4/main.c | 8 +++---
> drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +-
> drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phytbl_n.c | 186 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------
> 5 files changed, 101 insertions(+), 101 deletions(-)
Which makes me wonder why cocci didn't found above places...
Also cocci includes linux/kernel.h if not already present.
I will give above regex a try for the whole kernel tree and check for
false positives.
with kind regards
thomas
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] ipv6: sr: Use ARRAY_SIZE macro Thomas Meyer <thomas@m3y3r.de> - 2017-08-31 16:20 +0200
Re: [PATCH] ipv6: sr: Use ARRAY_SIZE macro David Miller <davem@davemloft.net> - 2017-09-02 03:40 +0200
Re: [PATCH] ipv6: sr: Use ARRAY_SIZE macro Joe Perches <joe@perches.com> - 2017-09-02 06:00 +0200
Re: [PATCH] ipv6: sr: Use ARRAY_SIZE macro Thomas Meyer <thomas@m3y3r.de> - 2017-09-02 08:30 +0200
csiph-web