mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'15330273260@189.cn'" <15330273260@189.cn>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Sui Jingfeng <suijingfeng@loongson.cn>, Li Yi <liyi@loongson.cn>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"loongson-kernel@lists.loongnix.cn" 
	<loongson-kernel@lists.loongnix.cn>
Subject: RE: [PATCH] drm/drm_vblank.c: avoid unsigned int to signed int cast
Date: Tue, 23 May 2023 08:50:30 +0000	[thread overview]
Message-ID: <e5effc4568034489acf2f4d4dad6eba9@AcuMS.aculab.com> (raw)
In-Reply-To: <4c9c0897-5e3a-1469-3d87-ff7723ac160c@189.cn>

From: 15330273260@189.cn <15330273260@189.cn>
> Sent: 23 May 2023 05:27
> 
> On 2023/5/22 19:29, Jani Nikula wrote:
> > In general, do not use unsigned types in arithmethic to avoid negative
> > values, because most people will be tripped over by integer promotion
> > rules, and you'll get negative values anyway.
> 
> 
> Here I'm sure about this,
> 
> but there are plenty unsigned types arithmetic in the kernel.

The real problem is (attempted) arithmetic on types smaller than int.
Regardless of whether they are signed or unsigned.

	David

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

  parent reply	other threads:[~2023-05-23  8:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16 17:30 Sui Jingfeng
2023-05-17 10:59 ` David Laight
2023-05-17 18:08   ` Sui Jingfeng
2023-05-22 11:29     ` Jani Nikula
2023-05-22 11:55       ` Sui Jingfeng
2023-05-22 12:07         ` David Laight
2023-05-22 12:13         ` Jani Nikula
2023-05-22 12:53           ` Sui Jingfeng
2023-05-22 15:01             ` Jani Nikula
2023-05-23  3:55               ` Sui Jingfeng
2023-05-23  4:26       ` Sui Jingfeng
2023-05-23  8:12         ` Sui Jingfeng
2023-05-23  8:50         ` David Laight [this message]
2023-05-23  9:55           ` Sui Jingfeng
  -- strict thread matches above, loose matches on Subject: below --
2023-05-16 16:59 Sui Jingfeng
2023-05-16 17:06 ` Thomas Zimmermann
2023-05-16 17:13   ` Sui Jingfeng

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=e5effc4568034489acf2f4d4dad6eba9@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=15330273260@189.cn \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liyi@loongson.cn \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=suijingfeng@loongson.cn \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®