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: <20170329143656.d89a2f139316df3f39a91db9@linux-foundation.org>
Date:   Wed, 29 Mar 2017 14:36:56 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc:     Niklas Söderlund 
        <niklas.soderlund+renesas@...natech.se>,
        Jessica Yu <jeyu@...hat.com>,
        Johannes Berg <johannes.berg@...el.com>,
        Petr Mladek <pmladek@...e.com>,
        Larry Finger <Larry.Finger@...inger.net>,
        linux-kernel@...r.kernel.org,
        Gustavo Padovan <gustavo.padovan@...labora.co.uk>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Peter Zijlstra <peterz@...radead.org>,
        Luis de Bethencourt <luisbg@....samsung.com>,
        Josh Triplett <josh@...htriplett.org>
Subject: Re: [PATCH] kernel.h: add IS_PTR_ALIGNED() macro

On Wed, 29 Mar 2017 19:22:10 +0900 Masahiro Yamada <yamada.masahiro@...ionext.com> wrote:

> We often check if a pointer has a specific alignment.  Because the
> '&' (bitwise AND) operator cannot take a pointer for the operand,
> so we need a cast like, IS_ALIGNED((unsigned long)p, a).
> 
> IS_PTR_ALIGNED will be useful as a shorthand.
> 
> ...
>
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -50,6 +50,7 @@
>  #define __ALIGN_MASK(x, mask)	__ALIGN_KERNEL_MASK((x), (mask))
>  #define PTR_ALIGN(p, a)		((typeof(p))ALIGN((unsigned long)(p), (a)))
>  #define IS_ALIGNED(x, a)		(((x) & ((typeof(x))(a) - 1)) == 0)
> +#define IS_PTR_ALIGNED(p, a)		(IS_ALIGNED((unsigned long)p, a))
>  
>  /* generic data direction definitions */
>  #define READ			0

It would be nice to see some conversions which actually use this new
macro.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ