* [LTP] [PATCH] sys_leds01: Fix max_brightness range check on 32-bit
@ 2026-11-13 22:54 Wake Liu via ltp
2026-11-13 23:56 ` [LTP] " linuxtestproject.agent
2026-11-16 13:22 ` [LTP] [PATCH] " Cyril Hrubis
0 siblings, 2 replies; 3+ messages in thread
From: Wake Liu via ltp @ 2026-11-13 22:54 UTC (permalink / raw)
To: ltp; +Cc: Wake Liu
The kernel stores max_brightness in struct led_classdev as unsigned int
and led-class.c exports it with "%u", so any value up to UINT_MAX is
valid.
The test checks it against LONG_MAX, which is only 2147483647 on 32-bit
userspace. An LED that reports a larger max_brightness, e.g. 4294967295,
makes the test fail on 32-bit while the same value passes on 64-bit.
Use TST_SYSFS_ASSERT_RANGEUU() with UINT_MAX as the upper bound. This
matches the kernel type on all architectures and follows the
tst_sysfs_assert.h guidance to use the unsigned variant for attributes
the kernel exports as an unsigned type.
Fixes: e996b5a6c2d9 ("testcases: sysfs: sys_leds01")
Signed-off-by: Wake Liu <wakel@google.com>
---
testcases/kernel/sysfs/class/leds/sys_leds01.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/sysfs/class/leds/sys_leds01.c b/testcases/kernel/sysfs/class/leds/sys_leds01.c
index 68e7f2094..50376d219 100644
--- a/testcases/kernel/sysfs/class/leds/sys_leds01.c
+++ b/testcases/kernel/sysfs/class/leds/sys_leds01.c
@@ -30,7 +30,7 @@ static void check_led(const char *name)
tst_res(TINFO, "Checking led '%s'", name);
- TST_SYSFS_ASSERT_RANGELL(1, LONG_MAX, PATH_CLASS_LEDS "/%s/max_brightness", name);
+ TST_SYSFS_ASSERT_RANGEUU(1, UINT_MAX, PATH_CLASS_LEDS "/%s/max_brightness", name);
TST_SYSFS_ASSERT_RANGELF(0, "brightness", "max_brightness",
PATH_CLASS_LEDS "/%s/", name);
--
2.56.0.611.g1030f0b940-goog
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] sys_leds01: Fix max_brightness range check on 32-bit
2026-11-13 22:54 [LTP] [PATCH] sys_leds01: Fix max_brightness range check on 32-bit Wake Liu via ltp
@ 2026-11-13 23:56 ` linuxtestproject.agent
2026-11-16 13:22 ` [LTP] [PATCH] " Cyril Hrubis
1 sibling, 0 replies; 3+ messages in thread
From: linuxtestproject.agent @ 2026-11-13 23:56 UTC (permalink / raw)
To: Wake Liu; +Cc: ltp
Hi Wake,
On Fri Nov 13 22:54:11 2026 +0000, Wake Liu wrote:
> sys_leds01: Fix max_brightness range check on 32-bit
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] sys_leds01: Fix max_brightness range check on 32-bit
2026-11-13 22:54 [LTP] [PATCH] sys_leds01: Fix max_brightness range check on 32-bit Wake Liu via ltp
2026-11-13 23:56 ` [LTP] " linuxtestproject.agent
@ 2026-11-16 13:22 ` Cyril Hrubis
1 sibling, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2026-11-16 13:22 UTC (permalink / raw)
To: Wake Liu; +Cc: ltp
Hi!
Applied, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-16 13:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 22:54 [LTP] [PATCH] sys_leds01: Fix max_brightness range check on 32-bit Wake Liu via ltp
2026-11-13 23:56 ` [LTP] " linuxtestproject.agent
2026-11-16 13:22 ` [LTP] [PATCH] " Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox