Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] unshare03: use sizeof(long long) to fix for 32bit
@ 2025-04-24 10:55 Avinesh Kumar
  2025-04-24 11:04 ` Petr Vorel
  2025-04-25  7:44 ` Petr Vorel
  0 siblings, 2 replies; 3+ messages in thread
From: Avinesh Kumar @ 2025-04-24 10:55 UTC (permalink / raw)
  To: ltp

when executing on 32bit compat layer
"nr_open = sizeof(long) * 8" does not evaluate to a large enough value
for /proc/sys/fs/nr_open.
unshare03.c:38: TBROK: Failed to close FILE '/proc/sys/fs/nr_open': EINVAL (22)
Use (long long) instead.

Fixes: fc8be6ed4 ("unshare03: Simplify EMFILE test by using fixed fd limit (sizeof(long) * 8)")
Suggested-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
 testcases/kernel/syscalls/unshare/unshare03.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/unshare/unshare03.c b/testcases/kernel/syscalls/unshare/unshare03.c
index c3b98930d..7128b3b97 100644
--- a/testcases/kernel/syscalls/unshare/unshare03.c
+++ b/testcases/kernel/syscalls/unshare/unshare03.c
@@ -27,7 +27,7 @@ static void run(void)
 		.exit_signal = SIGCHLD,
 	};
 
-	int nr_open = sizeof(long) * 8;
+	int nr_open = sizeof(long long) * 8;
 
 	SAFE_DUP2(2, nr_open + 1);
 
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] unshare03: use sizeof(long long) to fix for 32bit
  2025-04-24 10:55 [LTP] [PATCH] unshare03: use sizeof(long long) to fix for 32bit Avinesh Kumar
@ 2025-04-24 11:04 ` Petr Vorel
  2025-04-25  7:44 ` Petr Vorel
  1 sibling, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2025-04-24 11:04 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: ltp

Hi Avinesh,

> when executing on 32bit compat layer
> "nr_open = sizeof(long) * 8" does not evaluate to a large enough value
> for /proc/sys/fs/nr_open.
> unshare03.c:38: TBROK: Failed to close FILE '/proc/sys/fs/nr_open': EINVAL (22)
> Use (long long) instead.

> Fixes: fc8be6ed4 ("unshare03: Simplify EMFILE test by using fixed fd limit (sizeof(long) * 8)")
> Suggested-by: Petr Vorel <pvorel@suse.cz>
> Signed-off-by: Avinesh Kumar <akumar@suse.de>
> ---
>  testcases/kernel/syscalls/unshare/unshare03.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/testcases/kernel/syscalls/unshare/unshare03.c b/testcases/kernel/syscalls/unshare/unshare03.c
> index c3b98930d..7128b3b97 100644
> --- a/testcases/kernel/syscalls/unshare/unshare03.c
> +++ b/testcases/kernel/syscalls/unshare/unshare03.c
> @@ -27,7 +27,7 @@ static void run(void)
>  		.exit_signal = SIGCHLD,
>  	};

> -	int nr_open = sizeof(long) * 8;
> +	int nr_open = sizeof(long long) * 8;

Thank you!

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] unshare03: use sizeof(long long) to fix for 32bit
  2025-04-24 10:55 [LTP] [PATCH] unshare03: use sizeof(long long) to fix for 32bit Avinesh Kumar
  2025-04-24 11:04 ` Petr Vorel
@ 2025-04-25  7:44 ` Petr Vorel
  1 sibling, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2025-04-25  7:44 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: Lu Fei, ltp

Hi Avinesh, all,

merged, thank you!

> when executing on 32bit compat layer
> "nr_open = sizeof(long) * 8" does not evaluate to a large enough value
> for /proc/sys/fs/nr_open.
> unshare03.c:38: TBROK: Failed to close FILE '/proc/sys/fs/nr_open': EINVAL (22)
> Use (long long) instead.

> Fixes: fc8be6ed4 ("unshare03: Simplify EMFILE test by using fixed fd limit (sizeof(long) * 8)")
> Suggested-by: Petr Vorel <pvorel@suse.cz>
> Signed-off-by: Avinesh Kumar <akumar@suse.de>
> ---
>  testcases/kernel/syscalls/unshare/unshare03.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/testcases/kernel/syscalls/unshare/unshare03.c b/testcases/kernel/syscalls/unshare/unshare03.c
> index c3b98930d..7128b3b97 100644
> --- a/testcases/kernel/syscalls/unshare/unshare03.c
> +++ b/testcases/kernel/syscalls/unshare/unshare03.c
> @@ -27,7 +27,7 @@ static void run(void)
>  		.exit_signal = SIGCHLD,
>  	};

> -	int nr_open = sizeof(long) * 8;
> +	int nr_open = sizeof(long long) * 8;

>  	SAFE_DUP2(2, nr_open + 1);

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2025-04-25  7:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 10:55 [LTP] [PATCH] unshare03: use sizeof(long long) to fix for 32bit Avinesh Kumar
2025-04-24 11:04 ` Petr Vorel
2025-04-25  7:44 ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox