[Devel] [PATCH RHEL10 COMMIT] drivers/base/cpu: fix cpu/offline content inside a ve

Konstantin Khorenko khorenko at virtuozzo.com
Wed Aug 5 23:05:10 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.39.1.16.2.vz10
------>
commit fdfa48283061fcd77b59e4ba7d182d8af3e4198e
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Mon Jul 6 12:59:54 2026 +0200

    drivers/base/cpu: fix cpu/offline content inside a ve
    
    print_cpus_offline()'s non-super-ve early return passed len (declared
    0 at that point, used later only as the sysfs_emit_at() accumulator)
    as snprintf()'s size argument, so nothing was ever written to buf.
    Since sysfs zeroes the page before calling show(), reading
    /sys/devices/system/cpu/offline from inside a ve returned a single
    NUL byte instead of the intended empty line ("\n").
    
    Fixes: 44a8c49297f94 ("ve/cpu: handle sysfs attributes for CTs")
    Feature: sysfs: per-CT entries visibility and permissions configuration
    https://virtuozzo.atlassian.net/browse/VSTOR-137234
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 drivers/base/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 1e992254b12c6..b7ddc8346603c 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -263,7 +263,7 @@ static ssize_t print_cpus_offline(struct device *dev,
 	cpumask_var_t offline;
 
 	if (!ve_is_super(get_exec_env()))
-		return snprintf(buf, len, "\n");
+		return sysfs_emit(buf, "\n");
 
 	/* display offline cpus < nr_cpu_ids */
 	if (!alloc_cpumask_var(&offline, GFP_KERNEL))


More information about the Devel mailing list