From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: B K Karthik <bkkarthik@pesu.pes.edu>
Cc: Jiri Slaby <jirislaby@kernel.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
"Vabhav Sharma (OSS)" <vabhav.sharma@oss.nxp.com>,
"bhuvanchandra.dv@toradex.com" <bhuvanchandra.dv@toradex.com>
Subject: Re: [PATCH v2] tty: serial: fsl_lpuart.c: prevent a bad shift operation
Date: Wed, 29 Jul 2020 18:03:33 +0200 [thread overview]
Message-ID: <20200729160333.GA3652767@kroah.com> (raw)
In-Reply-To: <20200721174228.misj2mgqzcfz2lsj@pesu.pes.edu>
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@oss.nxp.com>
> Signed-off-by: B K Karthik <bkkarthik@pesu.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?
thanks,
greg k-h
next prev parent reply other threads:[~2020-07-29 16:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 17:42 [PATCH v2] tty: serial: fsl_lpuart.c: prevent a bad shift operation B K Karthik
2020-07-29 16:03 ` Greg Kroah-Hartman [this message]
2020-08-05 12:09 ` Vabhav Sharma (OSS)
2020-08-05 12:56 ` Greg Kroah-Hartman
2020-08-05 13:16 ` B K Karthik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200729160333.GA3652767@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=bhuvanchandra.dv@toradex.com \
--cc=bkkarthik@pesu.pes.edu \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=vabhav.sharma@oss.nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).