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] [day] [month] [year] [list]
Message-ID: <CAHp75VeC2MUEQTQnZMb96sz+P7gQVUPtds9CfxFf9t7rOVeXRg@mail.gmail.com>
Date:   Mon, 22 Mar 2021 18:11:37 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     "Rafael J. Wysocki" <rafael@...nel.org>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "open list:ACPI COMPONENT ARCHITECTURE (ACPICA)" <devel@...ica.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>,
        Robert Moore <robert.moore@...el.com>,
        Erik Kaneda <erik.kaneda@...el.com>
Subject: Re: [PATCH v3 1/1] ACPI: scan: Use unique number for instance_no

On Mon, Mar 22, 2021 at 5:42 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
> On Mon, Mar 22, 2021 at 4:02 PM Andy Shevchenko
> <andy.shevchenko@...il.com> wrote:
> > On Mon, Mar 22, 2021 at 4:57 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
> > > On Fri, Mar 19, 2021 at 8:21 PM Andy Shevchenko
> > > <andriy.shevchenko@...ux.intel.com> wrote:
> > > >
> > > > The decrementation of acpi_device_bus_id->instance_no
> > > > in acpi_device_del() is incorrect, because it may cause
> > > > a duplicate instance number to be allocated next time
> > > > a device with the same acpi_device_bus_id is added.
> > > >
> > > > Replace above mentioned approach by using IDA framework.
> >
> > ...
> >
> > > > +       result = ida_simple_get(&acpi_device_bus_id->instance_ida, 0, 255, GFP_KERNEL);
> > >
> > > This is ida_alloc_range(ida, start, (end) - 1, gfp), so I think it
> > > should be 256 above, instead of 255.
> >
> > Ah, good catch!
> >
> >
> > > While at it, though, there can be more than 256 CPU devices easily on
> > > contemporary systems, so I would use a greater number here.  Maybe
> > > 4096 and define a symbol for it?
> >
> > I was thinking about it, but there is a problem with the device name,
> > since it will break a lot of code,
>
> What problem is there?

If we have only 2 digits, but you are right, we have _at least_ two digits.

> > And taking into account that currently we don't change the behaviour
> > it is good enough per se as a fix.
> >
> > That said, we may extend by an additional patch with a logic like this:
> >
> > res = ida_get(4096)
> > if (res < 0)
> >   return res;
> > if (res >= 256)
> >  use %04x
> > else
> >  use %02x
> >
> > Would it make sense to you?
>
> I'm not sure why not to always use %02x ?  It doesn't truncate numbers
> longer than 2 digits AFAICS.

Yeah, should work. Thanks for review, I'll send a new version soon.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ