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: <20150309145844.GA19511@gmail.com>
Date:	Mon, 9 Mar 2015 15:58:44 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	Denys Vlasenko <dvlasenk@...hat.com>
Cc:	Andy Lutomirski <luto@...capital.net>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Borislav Petkov <bp@...en8.de>,
	"H. Peter Anvin" <hpa@...or.com>, Oleg Nesterov <oleg@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Alexei Starovoitov <ast@...mgrid.com>,
	Will Drewry <wad@...omium.org>,
	Kees Cook <keescook@...omium.org>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] move offsetofend() from vfio.h to stddef.h


* Denys Vlasenko <dvlasenk@...hat.com> wrote:

> Suggested by Linus.
> 
> Signed-off-by: Denys Vlasenko <dvlasenk@...hat.com>
> CC: Linus Torvalds <torvalds@...ux-foundation.org>
> CC: Steven Rostedt <rostedt@...dmis.org>
> CC: Ingo Molnar <mingo@...nel.org>
> CC: Borislav Petkov <bp@...en8.de>
> CC: "H. Peter Anvin" <hpa@...or.com>
> CC: Andy Lutomirski <luto@...capital.net>
> CC: Oleg Nesterov <oleg@...hat.com>
> CC: Frederic Weisbecker <fweisbec@...il.com>
> CC: Alexei Starovoitov <ast@...mgrid.com>
> CC: Will Drewry <wad@...omium.org>
> CC: Kees Cook <keescook@...omium.org>
> CC: x86@...nel.org
> CC: linux-kernel@...r.kernel.org
> ---
>  include/linux/stddef.h |  9 +++++++++
>  include/linux/vfio.h   | 13 -------------
>  2 files changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/include/linux/stddef.h b/include/linux/stddef.h
> index f4aec0e..076af43 100644
> --- a/include/linux/stddef.h
> +++ b/include/linux/stddef.h
> @@ -19,3 +19,12 @@ enum {
>  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
>  #endif
>  #endif
> +
> +/**
> + * offsetofend(TYPE, MEMBER)
> + *
> + * @TYPE: The type of the structure
> + * @MEMBER: The member within the structure to get the end offset of
> + */
> +#define offsetofend(TYPE, MEMBER) \
> +	(offsetof(TYPE, MEMBER)	+ sizeof(((TYPE *)0)->MEMBER))
> diff --git a/include/linux/vfio.h b/include/linux/vfio.h
> index 2d67b89..049b2f4 100644
> --- a/include/linux/vfio.h
> +++ b/include/linux/vfio.h
> @@ -78,19 +78,6 @@ extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
>  extern void vfio_unregister_iommu_driver(
>  				const struct vfio_iommu_driver_ops *ops);
>  
> -/**
> - * offsetofend(TYPE, MEMBER)
> - *
> - * @TYPE: The type of the structure
> - * @MEMBER: The member within the structure to get the end offset of
> - *
> - * Simple helper macro for dealing with variable sized structures passed
> - * from user space.  This allows us to easily determine if the provided
> - * structure is sized to include various fields.
> - */
> -#define offsetofend(TYPE, MEMBER) \
> -	(offsetof(TYPE, MEMBER)	+ sizeof(((TYPE *)0)->MEMBER))

So I like it, and because it is not particularly trivial when to use 
this primitive it was explained nicely in a description in the vfio.h 
version.

But you lost that nice description during the code move!!

Please don't.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ