All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] uapi/linux/stddef.h: add include guards
@ 2022-03-29 17:12 Tadeusz Struk
  2022-03-30 21:49 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tadeusz Struk @ 2022-03-29 17:12 UTC (permalink / raw)
  To: Kees Cook
  Cc: Dan Williams, Gustavo Silva, Keith Packard, linux-kernel, Tadeusz Struk

Add iclude guarde to uapi/linux/stddef.h to prevent
redefining macros.

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
---
 include/uapi/linux/stddef.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
index 3021ea25a284..7837ba4fe728 100644
--- a/include/uapi/linux/stddef.h
+++ b/include/uapi/linux/stddef.h
@@ -1,4 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_STDDEF_H
+#define _UAPI_LINUX_STDDEF_H
+
 #include <linux/compiler_types.h>
 
 #ifndef __always_inline
@@ -41,3 +44,4 @@
 		struct { } __empty_ ## NAME; \
 		TYPE NAME[]; \
 	}
+#endif
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] uapi/linux/stddef.h: add include guards
  2022-03-29 17:12 [PATCH] uapi/linux/stddef.h: add include guards Tadeusz Struk
@ 2022-03-30 21:49 ` Kees Cook
  2022-03-30 22:48   ` Tadeusz Struk
  2022-03-31 20:07 ` Kees Cook
  2022-03-31 20:25 ` Kees Cook
  2 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2022-03-30 21:49 UTC (permalink / raw)
  To: Tadeusz Struk; +Cc: Dan Williams, Gustavo Silva, Keith Packard, linux-kernel

On Tue, Mar 29, 2022 at 10:12:52AM -0700, Tadeusz Struk wrote:
> Add iclude guarde to uapi/linux/stddef.h to prevent
> redefining macros.
> 
> Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>

Hi!

What was tripping over this? This isn't a new file, so has something
changed with how it has been included?

-Kees

> ---
>  include/uapi/linux/stddef.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
> index 3021ea25a284..7837ba4fe728 100644
> --- a/include/uapi/linux/stddef.h
> +++ b/include/uapi/linux/stddef.h
> @@ -1,4 +1,7 @@
>  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +#ifndef _UAPI_LINUX_STDDEF_H
> +#define _UAPI_LINUX_STDDEF_H
> +
>  #include <linux/compiler_types.h>
>  
>  #ifndef __always_inline
> @@ -41,3 +44,4 @@
>  		struct { } __empty_ ## NAME; \
>  		TYPE NAME[]; \
>  	}
> +#endif
> -- 
> 2.35.1
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] uapi/linux/stddef.h: add include guards
  2022-03-30 21:49 ` Kees Cook
@ 2022-03-30 22:48   ` Tadeusz Struk
  0 siblings, 0 replies; 5+ messages in thread
From: Tadeusz Struk @ 2022-03-30 22:48 UTC (permalink / raw)
  To: Kees Cook; +Cc: Dan Williams, Gustavo Silva, Keith Packard, linux-kernel

On 3/30/22 14:49, Kees Cook wrote:
> On Tue, Mar 29, 2022 at 10:12:52AM -0700, Tadeusz Struk wrote:
>> Add iclude guarde to uapi/linux/stddef.h to prevent
>> redefining macros.
>>
>> Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
> 
> Hi!
> 
> What was tripping over this? This isn't a new file, so has something
> changed with how it has been included?

Hi Kees,
Yes, it isn't new, but up until 5.15 it had only three lines:

#ifndef __always_inline
#define __always_inline inline
#endif

https://elixir.bootlin.com/linux/v5.15.32/source/include/uapi/linux/stddef.h

and one could include it as many time as one would liked.
Now that it has more #defines, and since it is an user api that people
can directly include in their projects, wouldn't it need to have
the include guards to avoid warnings about redefined symbols?
All the other headers in include/uapi/linux/ do have that.

-- 
Thanks,
Tadeusz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] uapi/linux/stddef.h: add include guards
  2022-03-29 17:12 [PATCH] uapi/linux/stddef.h: add include guards Tadeusz Struk
  2022-03-30 21:49 ` Kees Cook
@ 2022-03-31 20:07 ` Kees Cook
  2022-03-31 20:25 ` Kees Cook
  2 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2022-03-31 20:07 UTC (permalink / raw)
  To: Tadeusz Struk; +Cc: Dan Williams, Gustavo Silva, Keith Packard, linux-kernel

On Tue, Mar 29, 2022 at 10:12:52AM -0700, Tadeusz Struk wrote:
> Add iclude guarde to uapi/linux/stddef.h to prevent
> redefining macros.
> 
> Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>

Acked-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] uapi/linux/stddef.h: add include guards
  2022-03-29 17:12 [PATCH] uapi/linux/stddef.h: add include guards Tadeusz Struk
  2022-03-30 21:49 ` Kees Cook
  2022-03-31 20:07 ` Kees Cook
@ 2022-03-31 20:25 ` Kees Cook
  2 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2022-03-31 20:25 UTC (permalink / raw)
  To: Tadeusz Struk
  Cc: Kees Cook, Dan Williams, linux-kernel, Keith Packard, Gustavo Silva

On Tue, 29 Mar 2022 10:12:52 -0700, Tadeusz Struk wrote:
> Add iclude guarde to uapi/linux/stddef.h to prevent
> redefining macros.

I cleaned up the commit log and applied this for-v5.18/hardening, thanks!

[1/1] uapi/linux/stddef.h: add include guards
      https://git.kernel.org/kees/c/55037ed7bdc6

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-31 20:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-29 17:12 [PATCH] uapi/linux/stddef.h: add include guards Tadeusz Struk
2022-03-30 21:49 ` Kees Cook
2022-03-30 22:48   ` Tadeusz Struk
2022-03-31 20:07 ` Kees Cook
2022-03-31 20:25 ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.