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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 9 Oct 2023 20:01:43 +0200
From:   Max Kellermann <max.kellermann@...os.com>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     Alessandro Zummo <a.zummo@...ertech.it>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/7] drivers/rtc/sysfs: move code to count_attribute_groups()

On Mon, Oct 9, 2023 at 7:24 PM Greg KH <gregkh@...uxfoundation.org> wrote:
> What 3 different purposes?

The variable gets initialized 3 times with different (unrelated) values:

1. count old rtc->dev.groups
2. count grps
3. allocate new rtc->dev.groups

This coding style is confusing and error prone. The code gets simpler
with this patch, because the cognitive load of understanding a
"count_attribute_groups()" call is lower than reading the "while" loop
and figuring out why it's there.

But I really wrote this patch because after making "rtc->dev.groups"
const, I cannot any longer assign it to "groups", because that
variable must remain non-const.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ