mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Jiri Slaby' <jirislaby@kernel.org>,
	Mohammad Mahfooz <mohammadmahfoozpersonal@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Johan Hovold" <johan@kernel.org>,
	"Alexander Vorwerk" <alexander.vorwerk@stud.uni-goettingen.de>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>
Subject: RE: [PATCH] serial: jsm: Use min_t instead of min
Date: Tue, 21 Feb 2023 12:48:54 +0000	[thread overview]
Message-ID: <f292a8314e334587979d1dc7edbf8085@AcuMS.aculab.com> (raw)
In-Reply-To: <70ea8ee5-3f92-fe1c-c59d-74040bd1e610@kernel.org>

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@gmail.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.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

  parent reply	other threads:[~2023-02-21 12:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-19 20:53 Mohammad Mahfooz
2023-02-20 11:52 ` Jiri Slaby
2023-02-21  1:03   ` [PATCH] serial: jsm: Change n to unsigned int Mohammad Mahfooz
2023-02-21  6:07     ` Jiri Slaby
2023-02-21 12:48   ` David Laight [this message]
2023-02-21 13:17     ` [PATCH] serial: jsm: Use min_t instead of min Ilpo Järvinen

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=f292a8314e334587979d1dc7edbf8085@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=alexander.vorwerk@stud.uni-goettingen.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mohammadmahfoozpersonal@gmail.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

Powered by JetHome