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:   Thu, 17 Aug 2023 22:24:11 +0200
From:   Alejandro Colomar <colomar.6.4.3@...il.com>
To:     Lucas Segarra Fernandez <lucas.segarra.fernandez@...el.com>,
        herbert@...dor.apana.org.au, linux-kernel@...r.kernel.org
Cc:     linux-crypto@...r.kernel.org, qat-linux@...el.com,
        andriy.shevchenko@...el.com,
        Giovanni Cabiddu <giovanni.cabiddu@...el.com>,
        Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH 1/4] linux/array_size.h: Move ARRAY_SIZE(arr) to a
 separate header

Hi Lucas,

On 2023-08-17 16:33, Lucas Segarra Fernandez wrote:
> From: Alejandro Colomar <alx.manpages@...il.com>
> 
> Touching files so used for the kernel,
> forces 'make' to recompile most of the kernel.
> 
> Having those definitions in more granular files
> helps avoid recompiling so much of the kernel.
> 
> Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>
> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@...el.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

Heh!  This is really really old, isn't it?  :p

Would you mind updating my email to use the kernel.org address?

From: Alejandro Colomar <alx@...nel.org>
Signed-off-by: Alejandro Colomar <alx@...nel.org>

Thanks for taking care of this patch!

Cheers,
Alex

> ---
>  include/linux/array_size.h                    | 13 +++++++++++++
>  include/linux/clk-provider.h                  |  1 +
>  include/linux/counter.h                       |  1 +
>  include/linux/genl_magic_func.h               |  1 +
>  include/linux/hashtable.h                     |  1 +
>  include/linux/kernel.h                        |  7 +------
>  include/linux/kfifo.h                         |  1 +
>  include/linux/kvm_host.h                      |  1 +
>  include/linux/moduleparam.h                   |  2 ++
>  include/linux/mtd/rawnand.h                   |  1 +
>  include/linux/netfilter.h                     |  1 +
>  include/linux/pagemap.h                       |  1 +
>  include/linux/phy.h                           |  1 +
>  include/linux/pinctrl/machine.h               |  2 +-
>  include/linux/property.h                      |  1 +
>  include/linux/rcupdate_wait.h                 |  1 +
>  include/linux/regmap.h                        |  1 +
>  include/linux/skmsg.h                         |  1 +
>  include/linux/string.h                        |  1 +
>  include/linux/surface_aggregator/controller.h |  1 +
>  20 files changed, 33 insertions(+), 7 deletions(-)
>  create mode 100644 include/linux/array_size.h
> 
> diff --git a/include/linux/array_size.h b/include/linux/array_size.h
> new file mode 100644
> index 000000000000..06d7d83196ca
> --- /dev/null
> +++ b/include/linux/array_size.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_ARRAY_SIZE_H
> +#define _LINUX_ARRAY_SIZE_H
> +
> +#include <linux/compiler.h>
> +
> +/**
> + * ARRAY_SIZE - get the number of elements in array @arr
> + * @arr: array to be sized
> + */
> +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> +
> +#endif  /* _LINUX_ARRAY_SIZE_H */
> diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> index 0f0cd01906b4..4f4d4f4af0a6 100644
> --- a/include/linux/clk-provider.h
> +++ b/include/linux/clk-provider.h
> @@ -6,6 +6,7 @@
>  #ifndef __LINUX_CLK_PROVIDER_H
>  #define __LINUX_CLK_PROVIDER_H
>  
> +#include <linux/array_size.h>
>  #include <linux/of.h>
>  #include <linux/of_clk.h>
>  
> diff --git a/include/linux/counter.h b/include/linux/counter.h
> index b63746637de2..baf4ffcd8d18 100644
> --- a/include/linux/counter.h
> +++ b/include/linux/counter.h
> @@ -6,6 +6,7 @@
>  #ifndef _COUNTER_H_
>  #define _COUNTER_H_
>  
> +#include <linux/array_size.h>
>  #include <linux/cdev.h>
>  #include <linux/device.h>
>  #include <linux/kernel.h>
> diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
> index 2984b0cb24b1..cec9cae51f0b 100644
> --- a/include/linux/genl_magic_func.h
> +++ b/include/linux/genl_magic_func.h
> @@ -2,6 +2,7 @@
>  #ifndef GENL_MAGIC_FUNC_H
>  #define GENL_MAGIC_FUNC_H
>  
> +#include <linux/array_size.h>
>  #include <linux/build_bug.h>
>  #include <linux/genl_magic_struct.h>
>  
> diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
> index f6c666730b8c..09c5f1522b06 100644
> --- a/include/linux/hashtable.h
> +++ b/include/linux/hashtable.h
> @@ -7,6 +7,7 @@
>  #ifndef _LINUX_HASHTABLE_H
>  #define _LINUX_HASHTABLE_H
>  
> +#include <linux/array_size.h>
>  #include <linux/list.h>
>  #include <linux/types.h>
>  #include <linux/kernel.h>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 0d91e0af0125..7195c6f27a22 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -11,6 +11,7 @@
>  #ifndef _LINUX_KERNEL_H
>  #define _LINUX_KERNEL_H
>  
> +#include <linux/array_size.h>
>  #include <linux/stdarg.h>
>  #include <linux/align.h>
>  #include <linux/limits.h>
> @@ -49,12 +50,6 @@
>  #define READ			0
>  #define WRITE			1
>  
> -/**
> - * ARRAY_SIZE - get the number of elements in array @arr
> - * @arr: array to be sized
> - */
> -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> -
>  #define PTR_IF(cond, ptr)	((cond) ? (ptr) : NULL)
>  
>  #define u64_to_user_ptr(x) (		\
> diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
> index 0b35a41440ff..b6fdd92ccb56 100644
> --- a/include/linux/kfifo.h
> +++ b/include/linux/kfifo.h
> @@ -36,6 +36,7 @@
>   * to lock the reader.
>   */
>  
> +#include <linux/array_size.h>
>  #include <linux/kernel.h>
>  #include <linux/spinlock.h>
>  #include <linux/stddef.h>
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 9d3ac7720da9..a629b398a592 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -3,6 +3,7 @@
>  #define __KVM_HOST_H
>  
>  
> +#include <linux/array_size.h>
>  #include <linux/types.h>
>  #include <linux/hardirq.h>
>  #include <linux/list.h>
> diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
> index 962cd41a2cb5..3cecef5fa1cf 100644
> --- a/include/linux/moduleparam.h
> +++ b/include/linux/moduleparam.h
> @@ -2,6 +2,8 @@
>  #ifndef _LINUX_MODULE_PARAMS_H
>  #define _LINUX_MODULE_PARAMS_H
>  /* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */
> +
> +#include <linux/array_size.h>
>  #include <linux/init.h>
>  #include <linux/stringify.h>
>  #include <linux/kernel.h>
> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> index 5159d692f9ce..cd27ef633a4f 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -13,6 +13,7 @@
>  #ifndef __LINUX_MTD_RAWNAND_H
>  #define __LINUX_MTD_RAWNAND_H
>  
> +#include <linux/array_size.h>
>  #include <linux/mtd/mtd.h>
>  #include <linux/mtd/nand.h>
>  #include <linux/mtd/flashchip.h>
> diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
> index d4fed4c508ca..f9ca506c4261 100644
> --- a/include/linux/netfilter.h
> +++ b/include/linux/netfilter.h
> @@ -2,6 +2,7 @@
>  #ifndef __LINUX_NETFILTER_H
>  #define __LINUX_NETFILTER_H
>  
> +#include <linux/array_size.h>
>  #include <linux/init.h>
>  #include <linux/skbuff.h>
>  #include <linux/net.h>
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 716953ee1ebd..7a3de980ed9d 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -5,6 +5,7 @@
>  /*
>   * Copyright 1995 Linus Torvalds
>   */
> +#include <linux/array_size.h>
>  #include <linux/mm.h>
>  #include <linux/fs.h>
>  #include <linux/list.h>
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 11c1e91563d4..39e88b570ead 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -11,6 +11,7 @@
>  #ifndef __PHY_H
>  #define __PHY_H
>  
> +#include <linux/array_size.h>
>  #include <linux/compiler.h>
>  #include <linux/spinlock.h>
>  #include <linux/ethtool.h>
> diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
> index 0639b36f43c5..ee8803f6ad07 100644
> --- a/include/linux/pinctrl/machine.h
> +++ b/include/linux/pinctrl/machine.h
> @@ -11,7 +11,7 @@
>  #ifndef __LINUX_PINCTRL_MACHINE_H
>  #define __LINUX_PINCTRL_MACHINE_H
>  
> -#include <linux/kernel.h>	/* ARRAY_SIZE() */
> +#include <linux/array_size.h>
>  
>  #include <linux/pinctrl/pinctrl-state.h>
>  
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 8c3c6685a2ae..f7889c7c3a66 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -10,6 +10,7 @@
>  #ifndef _LINUX_PROPERTY_H_
>  #define _LINUX_PROPERTY_H_
>  
> +#include <linux/array_size.h>
>  #include <linux/bits.h>
>  #include <linux/fwnode.h>
>  #include <linux/stddef.h>
> diff --git a/include/linux/rcupdate_wait.h b/include/linux/rcupdate_wait.h
> index 699b938358bf..a321404eeec0 100644
> --- a/include/linux/rcupdate_wait.h
> +++ b/include/linux/rcupdate_wait.h
> @@ -6,6 +6,7 @@
>   * RCU synchronization types and methods:
>   */
>  
> +#include <linux/array_size.h>
>  #include <linux/rcupdate.h>
>  #include <linux/completion.h>
>  
> diff --git a/include/linux/regmap.h b/include/linux/regmap.h
> index 8fc0b3ebce44..af0430dc0945 100644
> --- a/include/linux/regmap.h
> +++ b/include/linux/regmap.h
> @@ -10,6 +10,7 @@
>   * Author: Mark Brown <broonie@...nsource.wolfsonmicro.com>
>   */
>  
> +#include <linux/array_size.h>
>  #include <linux/list.h>
>  #include <linux/rbtree.h>
>  #include <linux/ktime.h>
> diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
> index 054d7911bfc9..d7e3b9f46d58 100644
> --- a/include/linux/skmsg.h
> +++ b/include/linux/skmsg.h
> @@ -4,6 +4,7 @@
>  #ifndef _LINUX_SKMSG_H
>  #define _LINUX_SKMSG_H
>  
> +#include <linux/array_size.h>
>  #include <linux/bpf.h>
>  #include <linux/filter.h>
>  #include <linux/scatterlist.h>
> diff --git a/include/linux/string.h b/include/linux/string.h
> index dbfc66400050..3c920b6d609b 100644
> --- a/include/linux/string.h
> +++ b/include/linux/string.h
> @@ -2,6 +2,7 @@
>  #ifndef _LINUX_STRING_H_
>  #define _LINUX_STRING_H_
>  
> +#include <linux/array_size.h>
>  #include <linux/compiler.h>	/* for inline */
>  #include <linux/types.h>	/* for size_t */
>  #include <linux/stddef.h>	/* for NULL */
> diff --git a/include/linux/surface_aggregator/controller.h b/include/linux/surface_aggregator/controller.h
> index cb7980805920..dcce0b663a3a 100644
> --- a/include/linux/surface_aggregator/controller.h
> +++ b/include/linux/surface_aggregator/controller.h
> @@ -12,6 +12,7 @@
>  #ifndef _LINUX_SURFACE_AGGREGATOR_CONTROLLER_H
>  #define _LINUX_SURFACE_AGGREGATOR_CONTROLLER_H
>  
> +#include <linux/array_size.h>
>  #include <linux/completion.h>
>  #include <linux/device.h>
>  #include <linux/types.h>

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5


Download attachment "OpenPGP_signature" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ