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]
Message-ID: <20210205123355.00006e06@Huawei.com>
Date:   Fri, 5 Feb 2021 12:33:55 +0000
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     Alexandru Ardelean <ardeleanalex@...il.com>
CC:     Alexandru Ardelean <alexandru.ardelean@...log.com>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        "Hennerich, Michael" <Michael.Hennerich@...log.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Nuno Sá <nuno.sa@...log.com>,
        "Bogdan, Dragos" <dragos.bogdan@...log.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v3 05/11] iio: buffer: group attr count and attr alloc


> > >
> > > +     attr = kcalloc(buffer_attrcount + ARRAY_SIZE(iio_buffer_attrs) + 1,
> > > +                    sizeof(struct attribute *), GFP_KERNEL);
> > > +     if (!attr) {
> > > +             ret = -ENOMEM;
> > > +             goto error_free_scan_mask;
> > > +     }
> > > +
> > > +     memcpy(attr, iio_buffer_attrs, sizeof(iio_buffer_attrs));
> > > +     if (!buffer->access->set_length)
> > > +             attr[0] = &dev_attr_length_ro.attr;
> > > +
> > > +     if (buffer->access->flags & INDIO_BUFFER_FLAG_FIXED_WATERMARK)
> > > +             attr[2] = &dev_attr_watermark_ro.attr;  
> >
> > Again a comment for the future  rather than now, but when we are copying
> > 4 items and then looking at whether to change 2 of them it might be cleaner
> > to just set them directly!  Touch of bit rot here :)  
> 
> So, I've been on-and-off about how to deal with this one.
> I wanted to clean it in various ways using new kernel sysfs APIs.
> Maybe, also remove the readonly variants and use the is_visible()
> property to set RO/RW modes.
> But I also came to the conclusion that this is an idea to address later.
> Trying to address this early-on confused me with other overlapping changes.
Absolutely agree. It's not something to do in this series.

Jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ