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] [day] [month] [year] [list]
Date:   Thu, 07 Nov 2019 08:54:37 -0500
From:   Mark Salter <msalter@...hat.com>
To:     Bart Van Assche <bvanassche@....org>,
        Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Christoph Hellwig <hch@....de>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
        Aurelien Jacquiot <jacquiot.aurelien@...il.com>
Subject: Re: [PATCH 2/9] c6x: Include <linux/unaligned/generic.h> instead of
 duplicating it

On Mon, 2019-10-28 at 13:06 -0700, Bart Van Assche wrote:
> Use the generic __{get,put}_unaligned_[bl]e() definitions instead of
> duplicating these. Since a later patch will add more definitions into
> <linux/unaligned/generic.h>, this patch ensures that these definitions
> have to be added only once. See also commit a7f626c1948a ("C6X: headers").
> See also commit 6510d41954dc ("kernel: Move arches to use common unaligned
> access").
> 
> Cc: Mark Salter <msalter@...hat.com>
> Cc: Aurelien Jacquiot <jacquiot.aurelien@...il.com>
> Signed-off-by: Bart Van Assche <bvanassche@....org>
> ---
>  arch/c6x/include/asm/unaligned.h | 65 +-------------------------------
>  1 file changed, 1 insertion(+), 64 deletions(-)
> 
> diff --git a/arch/c6x/include/asm/unaligned.h b/arch/c6x/include/asm/unaligned.h
> index b56ba7110f5a..d628cc170564 100644
> --- a/arch/c6x/include/asm/unaligned.h
> +++ b/arch/c6x/include/asm/unaligned.h
> @@ -10,6 +10,7 @@
>  #define _ASM_C6X_UNALIGNED_H
>  
>  #include <linux/swab.h>
> +#include <linux/unaligned/generic.h>
>  
>  /*
>   * The C64x+ can do unaligned word and dword accesses in hardware
> @@ -100,68 +101,4 @@ static inline void put_unaligned64(u64 val, const void *p)
>  
>  #endif
>  
> -/*
> - * Cause a link-time error if we try an unaligned access other than
> - * 1,2,4 or 8 bytes long
> - */
> -extern int __bad_unaligned_access_size(void);
> -
> -#define __get_unaligned_le(ptr) (typeof(*(ptr)))({			\
> -	sizeof(*(ptr)) == 1 ? *(ptr) :					\
> -	  (sizeof(*(ptr)) == 2 ? get_unaligned_le16((ptr)) :		\
> -	     (sizeof(*(ptr)) == 4 ? get_unaligned_le32((ptr)) :		\
> -		(sizeof(*(ptr)) == 8 ? get_unaligned_le64((ptr)) :	\
> -		   __bad_unaligned_access_size())));			\
> -	})
> -
> -#define __get_unaligned_be(ptr) (__force typeof(*(ptr)))({	\
> -	sizeof(*(ptr)) == 1 ? *(ptr) :					\
> -	  (sizeof(*(ptr)) == 2 ? get_unaligned_be16((ptr)) :		\
> -	     (sizeof(*(ptr)) == 4 ? get_unaligned_be32((ptr)) :		\
> -		(sizeof(*(ptr)) == 8 ? get_unaligned_be64((ptr)) :	\
> -		   __bad_unaligned_access_size())));			\
> -	})
> -
> -#define __put_unaligned_le(val, ptr) ({					\
> -	void *__gu_p = (ptr);						\
> -	switch (sizeof(*(ptr))) {					\
> -	case 1:								\
> -		*(u8 *)__gu_p = (__force u8)(val);			\
> -		break;							\
> -	case 2:								\
> -		put_unaligned_le16((__force u16)(val), __gu_p);		\
> -		break;							\
> -	case 4:								\
> -		put_unaligned_le32((__force u32)(val), __gu_p);		\
> -		break;							\
> -	case 8:								\
> -		put_unaligned_le64((__force u64)(val), __gu_p);		\
> -		break;							\
> -	default:							\
> -		__bad_unaligned_access_size();				\
> -		break;							\
> -	}								\
> -	(void)0; })
> -
> -#define __put_unaligned_be(val, ptr) ({					\
> -	void *__gu_p = (ptr);						\
> -	switch (sizeof(*(ptr))) {					\
> -	case 1:								\
> -		*(u8 *)__gu_p = (__force u8)(val);			\
> -		break;							\
> -	case 2:								\
> -		put_unaligned_be16((__force u16)(val), __gu_p);		\
> -		break;							\
> -	case 4:								\
> -		put_unaligned_be32((__force u32)(val), __gu_p);		\
> -		break;							\
> -	case 8:								\
> -		put_unaligned_be64((__force u64)(val), __gu_p);		\
> -		break;							\
> -	default:							\
> -		__bad_unaligned_access_size();				\
> -		break;							\
> -	}								\
> -	(void)0; })
> -
>  #endif /* _ASM_C6X_UNALIGNED_H */

Acked-by: Mark Salter <msalter@...hat.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ