lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_8CD1019C5E0B59CEF696BDBFC006361C2407@qq.com>
Date: Sat, 11 Oct 2025 16:58:08 +0800
From: Haofeng Li <920484857@...com>
To: John Stultz <jstultz@...gle.com>,
	Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org,
	Haofeng Li <13266079573@....com>
Subject: [Question] About off-by-one error in tk_aux_sysfs_init() loop

Hi all,

While reviewing the timekeeping sysfs initialization code, 
I noticed that in tk_aux_sysfs_init() the loop condition 
i <= MAX_AUX_CLOCKS appears to iterate one more time than intended.

Code in tk_aux_sysfs_init():

for (int i = 0; i <= MAX_AUX_CLOCKS; i++) {
    char id[2] = { [0] = '0' + i, };
    struct kobject *clk = kobject_create_and_add(id, auxo);
    // ...
}
With MAX_AUX_CLOCKS defined as 8, this loop runs 9 times (i = 0 to 8),
creating sysfs nodes for 9 auxiliary clocks. However, according 
to the comments, the kernel only supports up to 8 auxiliary clocks.

This seems like an off-by-one error that could lead to creating one 
more sysfs node than actually supported by the architecture constraints.

Would it make sense to change the loop condition to i < MAX_AUX_CLOCKS 
to properly align with the intended 8-clock limit?

Thanks for your time and consideration.

Thanks,
Haofeng Li


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ