[PATCH 6.1 5.15 5.10 5.4 4.19 4.14] selftests/memfd: Fix unknown type name build failure

Hardik Garg posted 1 patch 2 years, 8 months ago
tools/testing/selftests/memfd/fuse_test.c | 1 +
1 file changed, 1 insertion(+)
[PATCH 6.1 5.15 5.10 5.4 4.19 4.14] selftests/memfd: Fix unknown type name build failure
Posted by Hardik Garg 2 years, 8 months ago
Partially backport v6.3 commit 11f75a01448f ("selftests/memfd: add
tests for MFD_NOEXEC_SEAL MFD_EXEC") to fix an unknown type name 
build error.
In some systems, the __u64 typedef is not present due to differences
in system headers, causing compilation errors like this one:

fuse_test.c:64:8: error: unknown type name '__u64'
   64 | static __u64 mfd_assert_get_seals(int fd)

This header includes the  __u64 typedef which increases the
likelihood of successful compilation on a wider variety of systems.

Signed-off-by: Hardik Garg <hargar@linux.microsoft.com>
---
 tools/testing/selftests/memfd/fuse_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/memfd/fuse_test.c b/tools/testing/selftests/memfd/fuse_test.c
index be675002f918..93798c8c5d54 100644
--- a/tools/testing/selftests/memfd/fuse_test.c
+++ b/tools/testing/selftests/memfd/fuse_test.c
@@ -22,6 +22,7 @@
 #include <linux/falloc.h>
 #include <fcntl.h>
 #include <linux/memfd.h>
+#include <linux/types.h>
 #include <sched.h>
 #include <stdio.h>
 #include <stdlib.h>
-- 
2.25.1
Re: [PATCH 6.1 5.15 5.10 5.4 4.19 4.14] selftests/memfd: Fix unknown type name build failure
Posted by Greg KH 2 years, 8 months ago
On Fri, May 26, 2023 at 04:21:36PM -0700, Hardik Garg wrote:
> Partially backport v6.3 commit 11f75a01448f ("selftests/memfd: add
> tests for MFD_NOEXEC_SEAL MFD_EXEC") to fix an unknown type name 
> build error.
> In some systems, the __u64 typedef is not present due to differences
> in system headers, causing compilation errors like this one:
> 
> fuse_test.c:64:8: error: unknown type name '__u64'
>    64 | static __u64 mfd_assert_get_seals(int fd)
> 
> This header includes the  __u64 typedef which increases the
> likelihood of successful compilation on a wider variety of systems.
> 
> Signed-off-by: Hardik Garg <hargar@linux.microsoft.com>
> ---
>  tools/testing/selftests/memfd/fuse_test.c | 1 +
>  1 file changed, 1 insertion(+)

Now queued up, thanks.

greg k-h
Re: [PATCH 6.1 5.15 5.10 5.4 4.19 4.14] selftests/memfd: Fix unknown type name build failure
Posted by Tyler Hicks 2 years, 8 months ago
On 2023-05-26 16:21:36, Hardik Garg wrote:
> Partially backport v6.3 commit 11f75a01448f ("selftests/memfd: add
> tests for MFD_NOEXEC_SEAL MFD_EXEC") to fix an unknown type name 
> build error.
> In some systems, the __u64 typedef is not present due to differences
> in system headers, causing compilation errors like this one:
> 
> fuse_test.c:64:8: error: unknown type name '__u64'
>    64 | static __u64 mfd_assert_get_seals(int fd)
> 
> This header includes the  __u64 typedef which increases the
> likelihood of successful compilation on a wider variety of systems.
> 
> Signed-off-by: Hardik Garg <hargar@linux.microsoft.com>

Reviewed-by: Tyler Hicks (Microsoft) <code@tyhicks.com>

Tyler

> ---
>  tools/testing/selftests/memfd/fuse_test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/memfd/fuse_test.c b/tools/testing/selftests/memfd/fuse_test.c
> index be675002f918..93798c8c5d54 100644
> --- a/tools/testing/selftests/memfd/fuse_test.c
> +++ b/tools/testing/selftests/memfd/fuse_test.c
> @@ -22,6 +22,7 @@
>  #include <linux/falloc.h>
>  #include <fcntl.h>
>  #include <linux/memfd.h>
> +#include <linux/types.h>
>  #include <sched.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> -- 
> 2.25.1
>