All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/2] shmctl03 fix on 32bit compat mode
@ 2026-09-18 12:50 Petr Vorel
  2026-09-18 12:50 ` [LTP] [PATCH 1/2] tst_assert: Use 'long long' to fix 32bit compat mode truncation Petr Vorel
  2026-09-18 12:50 ` [LTP] [PATCH 2/2] shmctl03: Fix shmmax clamped to INT_MAX in 32bit compat mode Petr Vorel
  0 siblings, 2 replies; 9+ messages in thread
From: Petr Vorel @ 2026-09-18 12:50 UTC (permalink / raw)
  To: ltp

Hi all,

this is yet another attempt to fix shmctl03 on 32 bit compat mode,
alternative to Wei's suggestion [1]. We should merge one of these.

Code suggested by Andrea, I turn it into 2 commits.
Based on the fact that general code was needed only for shmctl03, adding
extra enums is probably not worth.

Kind regards,
Petr

[1] https://patchwork.kernel.org/project/ltp/list/?series=1156943&state=*

Andrea Cervesato (2):
  tst_assert: Use 'long long' to fix 32bit compat mode truncation
  shmctl03: Fix shmmax clamped to INT_MAX in 32bit compat mode

 lib/tst_assert.c                            | 9 +++++----
 testcases/kernel/syscalls/shmctl/shmctl03.c | 6 +++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

-- 
2.55.0


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

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [LTP] [PATCH v2 1/3] tst_assert: Use 'long long' to fix 32bit compat mode truncation
@ 2026-09-24 11:25 Petr Vorel
  2026-09-24 13:24 ` [LTP] " linuxtestproject.agent
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2026-09-24 11:25 UTC (permalink / raw)
  To: ltp

From: Andrea Cervesato <andrea.cervesato@suse.com>

Using 'long long' in tst_assert_ulong() correctly verifies values on
32bit compat mode truncation.

This fixes failure of shmctl03.c on /proc/sys/kernel/shmall on 32bit
(potentially on other sysfs files).

Reported-by: Wei Gao <wegao@suse.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
[ pvorel: separate into its own commit, write the commit message ]
Co-developed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/tst_assert.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/tst_assert.c b/lib/tst_assert.c
index b68bd5d397..5a4896ac52 100644
--- a/lib/tst_assert.c
+++ b/lib/tst_assert.c
@@ -25,16 +25,17 @@ void tst_assert_int(const char *file, const int lineno, const char *path, int va
 
 void tst_assert_ulong(const char *file, const int lineno, const char *path, unsigned long val)
 {
-	unsigned long sys_val;
+	unsigned long long sys_val;
 
-	safe_file_scanf(file, lineno, NULL, path, "%lu", &sys_val);
+	safe_file_scanf(file, lineno, NULL, path, "%llu", &sys_val);
 
-	if (val == sys_val) {
+	if (val == (unsigned long)sys_val) {
 		tst_res_(file, lineno, TPASS, "%s = %lu", path, val);
 		return;
 	}
 
-	tst_res_(file, lineno, TFAIL, "%s != %lu got %lu", path, val, sys_val);
+	tst_res_(file, lineno, TFAIL, "%s != %lu got %lu",
+		path, val, (unsigned long)sys_val);
 }
 
 void tst_assert_file_int(const char *file, const int lineno, const char *path, const char *prefix, int val)
-- 
2.55.0


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

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

end of thread, other threads:[~2026-09-25  6:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 12:50 [LTP] [PATCH 0/2] shmctl03 fix on 32bit compat mode Petr Vorel
2026-09-18 12:50 ` [LTP] [PATCH 1/2] tst_assert: Use 'long long' to fix 32bit compat mode truncation Petr Vorel
2026-09-18 17:06   ` [LTP] " linuxtestproject.agent
2026-09-22  7:35     ` Petr Vorel
2026-09-18 12:50 ` [LTP] [PATCH 2/2] shmctl03: Fix shmmax clamped to INT_MAX in 32bit compat mode Petr Vorel
2026-09-23 11:11   ` Cyril Hrubis
2026-09-24 11:03     ` Petr Vorel
  -- strict thread matches above, loose matches on Subject: below --
2026-09-24 11:25 [LTP] [PATCH v2 1/3] tst_assert: Use 'long long' to fix 32bit compat mode truncation Petr Vorel
2026-09-24 13:24 ` [LTP] " linuxtestproject.agent
2026-09-25  6:55   ` Petr Vorel

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.