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: Wed, 14 Feb 2024 10:09:10 -0800
From: Randy Dunlap <rdunlap@...radead.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
 linux-kernel@...r.kernel.org
Cc: Kees Cook <keescook@...omium.org>,
 Michal Wajdeczko <michal.wajdeczko@...el.com>
Subject: Re: [PATCH v1 1/1] kernel.h: Move upper_*_bits() and lower_*_bits()
 to wordpath.h



On 2/14/24 09:26, Andy Shevchenko wrote:
> The wordpart.h header is collecting APIs related to the handling
> parts of the word (usually in byte granularity). The upper_*_bits()
> and lower_*_bits() are good candidates to be moved to there.
> 
> This helps to clean up header dependency hell with regard to kernel.h
> as the latter gathers completely unrelated stuff together and slows
> down compilation (especially when it's included into other header).
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> 
> Kees, since wordpart.h is now only in your tree, this is supposed
> to go there as well.

after someone corrects the Subject (wordpath -> wordpart).

Reviewed-by: Randy Dunlap <rdunlap@...radead.org>


> 
>  include/linux/kernel.h   | 30 ++----------------------------
>  include/linux/wordpart.h | 29 +++++++++++++++++++++++++++++
>  2 files changed, 31 insertions(+), 28 deletions(-)
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 5f74733391ed..d718fbec72dd 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -33,6 +33,8 @@
>  #include <linux/sprintf.h>
>  #include <linux/static_call_types.h>
>  #include <linux/instruction_pointer.h>
> +#include <linux/wordpart.h>
> +
>  #include <asm/byteorder.h>
>  
>  #include <uapi/linux/kernel.h>
> @@ -52,34 +54,6 @@
>  }					\
>  )
>  
> -/**
> - * upper_32_bits - return bits 32-63 of a number
> - * @n: the number we're accessing
> - *
> - * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
> - * the "right shift count >= width of type" warning when that quantity is
> - * 32-bits.
> - */
> -#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
> -
> -/**
> - * lower_32_bits - return bits 0-31 of a number
> - * @n: the number we're accessing
> - */
> -#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
> -
> -/**
> - * upper_16_bits - return bits 16-31 of a number
> - * @n: the number we're accessing
> - */
> -#define upper_16_bits(n) ((u16)((n) >> 16))
> -
> -/**
> - * lower_16_bits - return bits 0-15 of a number
> - * @n: the number we're accessing
> - */
> -#define lower_16_bits(n) ((u16)((n) & 0xffff))
> -
>  struct completion;
>  struct user;
>  
> diff --git a/include/linux/wordpart.h b/include/linux/wordpart.h
> index c9e6bd773ebd..f6f8f83b15b0 100644
> --- a/include/linux/wordpart.h
> +++ b/include/linux/wordpart.h
> @@ -2,6 +2,35 @@
>  
>  #ifndef _LINUX_WORDPART_H
>  #define _LINUX_WORDPART_H
> +
> +/**
> + * upper_32_bits - return bits 32-63 of a number
> + * @n: the number we're accessing
> + *
> + * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
> + * the "right shift count >= width of type" warning when that quantity is
> + * 32-bits.
> + */
> +#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
> +
> +/**
> + * lower_32_bits - return bits 0-31 of a number
> + * @n: the number we're accessing
> + */
> +#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
> +
> +/**
> + * upper_16_bits - return bits 16-31 of a number
> + * @n: the number we're accessing
> + */
> +#define upper_16_bits(n) ((u16)((n) >> 16))
> +
> +/**
> + * lower_16_bits - return bits 0-15 of a number
> + * @n: the number we're accessing
> + */
> +#define lower_16_bits(n) ((u16)((n) & 0xffff))
> +
>  /**
>   * REPEAT_BYTE - repeat the value @x multiple times as an unsigned long value
>   * @x: value to repeat

-- 
#Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ