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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZNYBjafHuutSrN4B@smile.fi.intel.com>
Date:   Fri, 11 Aug 2023 12:38:21 +0300
From:   Andy Shevchenko <andriy.shevchenko@...el.com>
To:     Tony Lindgren <tony@...mide.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jirislaby@...nel.org>, Dhruva Gole <d-gole@...com>,
        Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        John Ogness <john.ogness@...utronix.de>,
        Johan Hovold <johan@...nel.org>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Vignesh Raghavendra <vigneshr@...com>,
        linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
        Guenter Roeck <linux@...ck-us.net>
Subject: Re: [PATCH] serial: core: Fix serial core port id, including
 multiport devices

On Fri, Aug 11, 2023 at 12:35:56PM +0300, Andy Shevchenko wrote:
> On Fri, Aug 11, 2023 at 12:35:01PM +0300, Andy Shevchenko wrote:
> > On Fri, Aug 11, 2023 at 08:11:21AM +0300, Tony Lindgren wrote:
> > > * Andy Shevchenko <andriy.shevchenko@...el.com> [230810 15:26]:
> > > > On Thu, Aug 10, 2023 at 06:24:13PM +0300, Andy Shevchenko wrote:
> > > > > On Thu, Aug 10, 2023 at 09:57:34AM +0300, Tony Lindgren wrote:

...

> > > > > > +	unsigned int min = 0, max = ~0U;
> > > > > 
> > > > > Shouldn't this be int? The max IIRC will be INT_MAX with this anyway.
> > > > 
> > > > Ah, and then you can supply is as 0 (IIRC).
> > > 
> > > The returned id will be INT_MAX, but idr.h uses unsigned int:
> > > 
> > > int ida_alloc_range(struct ida *, unsigned int min, unsigned int max, gfp_t);
> > > 
> > > If there's some reason to limit max id we can do it, otherwise it's just
> > > a don't care flag.
> > > 
> > > Please clarify if I'm not following what you are suggesting :)
> > 
> > 	... max = 0;
> > 
> > Will have the same effect with more explicit intention "use whatever maximum is
> > default". With ~0U I would expect to see something bigger than INT_MAX, but it
> > won't ever appear.
> 
> You can put a comment on top
> 
> 	/* Use 0 for max to apply IDA defaults */

Hmm... Looking into the implementation code it seems better to have

	/* Use -1 for max to apply IDA defaults */
	int min = 0, max = -1;

And supply like that.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ