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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 02 Nov 2009 11:40:27 +0100
From:	Tilman Schmidt <tilman@...p.cc>
To:	Thiago Farina <tfransosi@...il.com>
CC:	Randy Dunlap <rdunlap@...otime.net>,
	Nigel Cunningham <ncunningham@...a.org.au>,
	André Goddard Rosa <andre.goddard@...il.com>,
	trivial@...nel.org, linux list <linux-kernel@...r.kernel.org>
Subject: ARRAY_SIZE (was: [PATCH 03/16] trivial: fix assorted "through" typos)

Am 01.11.2009 22:13 schrieb Thiago Farina:
> 
> Talking about cleanup, there are many definitions of ARRAY_SIZE, found
> using cscope:
> 0 spidev_test.c  24 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
> 1 page-types.c  194 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> 2 types.h         4 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> 3 user.h         17 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> 4 boot.h         35 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
> 5 relocs.c       13 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> 6 kernel.h       46 #define ARRAY_SIZE(arr) (sizeof(arr) /
> sizeof((arr)[0]) + __must_be_array(arr))
> 7 dtc.h          83 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> 8 genksyms.c    314 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
> 9 kallsyms.c     27 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
> a file2alias.c  520 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> b util.h         28 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))

You should have included the files' directory paths. That would have
shown that seven of these aren't in actual kernel source files at all:
two in the Documentation tree, four in scripts, and one in tools.
Four are in the arch tree, and are needed for boot or userspace code.
There only remains one: the definition in include/linux/kernel.h which
is the "official" one for regular kernel code.

Now the number of places which could use that macro but open-code it
instead is a completely different story. See
http://www.crashcourse.ca/wiki/index.php/The_style_script
for a list of candidates.

-- 
Tilman Schmidt                    E-Mail: tilman@...p.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


Download attachment "signature.asc" of type "application/pgp-signature" (255 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ