lkml.org 
[lkml]   [2023]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] drm/drm_vblank.c: avoid unsigned int to signed int cast
Date
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)
\
 
 \ /
  Last update: 2023-05-23 10:51    [W:0.113 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site