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: <VI1PR04MB480018F32A080BC5CC76E3C7F34B0@VI1PR04MB4800.eurprd04.prod.outlook.com>
Date:   Wed, 5 Aug 2020 12:09:34 +0000
From:   "Vabhav Sharma (OSS)" <vabhav.sharma@....nxp.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        B K Karthik <bkkarthik@...u.pes.edu>
CC:     Jiri Slaby <jirislaby@...nel.org>,
        "linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Vabhav Sharma (OSS)" <vabhav.sharma@....nxp.com>,
        "bhuvanchandra.dv@...adex.com" <bhuvanchandra.dv@...adex.com>
Subject: RE: [PATCH v2] tty: serial: fsl_lpuart.c: prevent a bad shift
 operation



> -----Original Message-----
> From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Sent: Wednesday, July 29, 2020 9:34 PM
> To: B K Karthik <bkkarthik@...u.pes.edu>
> Cc: Jiri Slaby <jirislaby@...nel.org>; linux-serial@...r.kernel.org; linux-
> kernel@...r.kernel.org; Vabhav Sharma (OSS)
> <vabhav.sharma@....nxp.com>; bhuvanchandra.dv@...adex.com
> Subject: Re: [PATCH v2] tty: serial: fsl_lpuart.c: prevent a bad shift operation
> 
> On Tue, Jul 21, 2020 at 11:12:29PM +0530, B K Karthik wrote:
> > prevent a bad shift operation by verifying that the argument to fls is
> > non zero.
> >
> > Reported-by: "Vabhav Sharma (OSS)" <vabhav.sharma@....nxp.com>
> > Signed-off-by: B K Karthik <bkkarthik@...u.pes.edu>
> > ---
> > v1 -> v2:
> > 	added Reported-by tag
> >
> >  drivers/tty/serial/fsl_lpuart.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/tty/serial/fsl_lpuart.c
> > b/drivers/tty/serial/fsl_lpuart.c index 7ca642249224..0cc64279cd2d
> > 100644
> > --- a/drivers/tty/serial/fsl_lpuart.c
> > +++ b/drivers/tty/serial/fsl_lpuart.c
> > @@ -1168,7 +1168,8 @@ static inline int lpuart_start_rx_dma(struct
> lpuart_port *sport)
> >  	 * 10ms at any baud rate.
> >  	 */
> >  	sport->rx_dma_rng_buf_len = (DMA_RX_TIMEOUT * baud /  bits /
> 1000) * 2;
> > -	sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len)
> - 1));
> > +	if (sport->rx_dma_rng_buf_len != 0)
> 
> How can this variable become 0?
Condition x, taking false branch
Explicitly returning zero 

static __always_inline int fls(unsigned int x)
{
	return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
}
> 
> thanks,
> 
> greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ