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:   Tue, 20 Sep 2022 16:25:42 +0000
From:   SeongJae Park <sj@...nel.org>
To:     haoxin <xhao@...ux.alibaba.com>
Cc:     SeongJae Park <sj@...nel.org>, akpm@...ux-foundation.org,
        damon@...ts.linux.dev, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/2] mm/damon/sysfs: use kzmalloc instead kmalloc to simplify codes

Hi Xin,

On Tue, 20 Sep 2022 09:58:41 +0800 haoxin <xhao@...ux.alibaba.com> wrote:

> 
> 在 2022/9/20 上午1:22, SeongJae Park 写道:
> > On Mon, 19 Sep 2022 23:12:01 +0800 Xin Hao <xhao@...ux.alibaba.com> wrote:
> >
> >> In damon_sysfs_access_pattern_alloc() adn damon_sysfs_attrs_alloc(),
> >> we can use kzmalloc to alloc instance of the related structs, This makes
> >> the function code much cleaner.
> > This definitely makes the code cleaner, thank you.  But, the initial intent of
> > the code is to initialize the fiedls that really need to be initialized at the
> > point, for the efficiency and also for making it clear which field is needed to
> > be initialized to what value here.  It's also intended to make readers wonder
> > about where and how the remaining fields are initialized.
> 
> Maybe the other func like damon_sysfs_kdamonds_alloc() also need to do 
> like this, you can see it return directly by
> 
> kzalloc.
> 
> static struct damon_sysfs_kdamonds *damon_sysfs_kdamonds_alloc(void)
> {
>              return kzalloc(sizeof(struct damon_sysfs_kdamonds), 
> GFP_KERNEL);
> }

In this case, all the fields of the struct need to be initialized as zero.
That's why we use kzalloc() there.

Of course, my opinion is not a static and concrete rule, but changing mind.
And obviously everyone makes many mistakes and DAMON code has many rooms for
improvement.  I really appreciate for your greatful efforts for that.  But, at
least in this case, I think it doesn't really need the change at the moment,
IMHO.


Thanks,
SJ

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ