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]
Message-ID: <20221207184105.74dfdd1c@kernel.org>
Date:   Wed, 7 Dec 2022 18:41:05 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Jesse Brandeburg <jesse.brandeburg@...el.com>
Cc:     davem@...emloft.net, pabeni@...hat.com, netdev@...r.kernel.org,
        mkubecek@...e.cz
Subject: Re: [PATCH net-next v1 1/2] ethtool/uapi: use BIT for bit-shifts

On Wed,  7 Dec 2022 15:17:27 -0800 Jesse Brandeburg wrote:
>  #define ETH_RSS_HASH_TOP	__ETH_RSS_HASH(TOP)
> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index 58e587ba0450..6ce5da444098 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -9,6 +9,7 @@
>   *                                christopher.leech@...el.com,
>   *                                scott.feldman@...el.com)
>   * Portions Copyright (C) Sun Microsystems 2008
> + * Portions Copyright (C) 2022 Intel Corporation

Is that appropriate?

> +/* BIT() and BIT_ULL() are defined in include/linux/bits.h but we need a
> + * local version to clean up this file and not break simultaneous
> + * kernel/userspace where userspace doesn't have the BIT and BIT_ULL
> + * defined. To avoid compiler issues we use the exact same definitions here
> + * of the macros as defined in the file noted below, so that we don't get
> + * 'duplicate define' or 'redefinition' errors.
> + */
> +/* include/uapi/linux/const.h */
> +#define __AC(X,Y)	(X##Y)
> +#define _AC(X,Y)	__AC(X,Y)
> +#define _AT(T,X)	((T)(X))
> +#define _UL(x)		(_AC(x, UL))
> +#define _ULL(x)		(_AC(x, ULL))
> +/* include/vdso/linux/const.h */
> +#define UL(x)		(_UL(x))
> +#define ULL(x)		(_ULL(x))
> +/* include/vdso/bits.h */
> +#define BIT(nr)		(UL(1) << (nr))
> +/* include/linux/bits.h */
> +#define BIT_ULL(nr)	(ULL(1) << (nr))

include/uapi/linux/const.h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ