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: <26205580-7c9-685d-d8b7-6128cbe4f612@linux.intel.com>
Date:   Tue, 21 Feb 2023 15:17:32 +0200 (EET)
From:   Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To:     David Laight <David.Laight@...LAB.COM>
cc:     'Jiri Slaby' <jirislaby@...nel.org>,
        Mohammad Mahfooz <mohammadmahfoozpersonal@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Johan Hovold <johan@...nel.org>,
        Alexander Vorwerk <alexander.vorwerk@...d.uni-goettingen.de>,
        "linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>
Subject: RE: [PATCH] serial: jsm: Use min_t instead of min

On Tue, 21 Feb 2023, David Laight wrote:

> From: Jiri Slaby
> > Sent: 20 February 2023 11:52
> > 
> > On 19. 02. 23, 21:53, Mohammad Mahfooz wrote:
> > > Use min_t instead of min to cut down n further if needed.
> > >
> > > Signed-off-by: Mohammad Mahfooz <mohammadmahfoozpersonal@...il.com>
> > > ---
> > >   drivers/tty/serial/jsm/jsm_neo.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
> > > index 0c78f66276cd..4cce1e423b06 100644
> > > --- a/drivers/tty/serial/jsm/jsm_neo.c
> > > +++ b/drivers/tty/serial/jsm/jsm_neo.c
> > > @@ -350,7 +350,7 @@ static void neo_copy_data_from_uart_to_queue(struct jsm_channel *ch)
> > >   		 * IBM pSeries platform.
> > >   		 * 15 bytes max appears to be the magic number.
> > >   		 */
> > > -		n = min((u32) n, (u32) 12);
> > > +		n = min_t(u32, n, 12);
> > 
> > Nah, why is "n" signed in the first place? Could you fix that and all
> > all those casts in min()s around instead?
> 
> There is also a (IIRC) 'fifo_space -= 3;' in there that could
> also generate negatives.
> 
> I took one look at that function and ran away.

min_t() casts before compare so it would never work correctly if a 
negative number is fed into min_t(u32, ...).

Not that negative FIFO "space" makes any sense (and should be prevent 
at its source to begin with).

-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ