2024-05-06 17:42:38

by Erick Archer

[permalink] [raw]
Subject: [PATCH] uapi: stddef.h: Provide UAPI macros for __counted_by_{le, be}

Provide UAPI macros for UAPI structs that will gain annotations for
__counted_by_{le, be} attributes.

Signed-off-by: Erick Archer <[email protected]>
---
include/uapi/linux/stddef.h | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
index 2ec6f35cda32..58154117d9b0 100644
--- a/include/uapi/linux/stddef.h
+++ b/include/uapi/linux/stddef.h
@@ -55,4 +55,12 @@
#define __counted_by(m)
#endif

+#ifndef __counted_by_le
+#define __counted_by_le(m)
+#endif
+
+#ifndef __counted_by_be
+#define __counted_by_be(m)
+#endif
+
#endif /* _UAPI_LINUX_STDDEF_H */
--
2.25.1



2024-05-06 17:50:21

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH] uapi: stddef.h: Provide UAPI macros for __counted_by_{le, be}

On Mon, May 6, 2024 at 7:42 PM Erick Archer <[email protected]> wrote:
>
> Provide UAPI macros for UAPI structs that will gain annotations for
> __counted_by_{le, be} attributes.
>
> Signed-off-by: Erick Archer <[email protected]>

I guess this is a mirror of the kernel one at
https://lore.kernel.org/lkml/[email protected]/,
but it would be nice to add some context, e.g. Link: tag, to this, and
possibly a comment or two.

Thanks!

Cheers,
Miguel

2024-05-07 13:05:54

by Alexander Lobakin

[permalink] [raw]
Subject: Re: [PATCH] uapi: stddef.h: Provide UAPI macros for __counted_by_{le, be}

From: Erick Archer <[email protected]>
Date: Mon, 6 May 2024 19:42:08 +0200

> Provide UAPI macros for UAPI structs that will gain annotations for
> __counted_by_{le, be} attributes.

Pls add me to Cc next time.

Why is this change needed? __counted_by_{le, be}() aren't used anywhere
in the uAPI headers.

>
> Signed-off-by: Erick Archer <[email protected]>
> ---
> include/uapi/linux/stddef.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
> index 2ec6f35cda32..58154117d9b0 100644
> --- a/include/uapi/linux/stddef.h
> +++ b/include/uapi/linux/stddef.h
> @@ -55,4 +55,12 @@
> #define __counted_by(m)
> #endif
>
> +#ifndef __counted_by_le
> +#define __counted_by_le(m)
> +#endif
> +
> +#ifndef __counted_by_be
> +#define __counted_by_be(m)
> +#endif
> +
> #endif /* _UAPI_LINUX_STDDEF_H */

Thanks,
Olek