[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e2ec77060cc84a33b49d5fd11d7867f6@AcuMS.aculab.com>
Date: Wed, 19 Oct 2022 10:31:17 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Kang Minchul' <tegongkang@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>
CC: Dan Carpenter <error27@...il.com>,
Sidong Yang <realwakka@...il.com>,
"linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] staging: pi433: Use div64_u64 instead of do_div
From: Kang Minchul
> Sent: 19 October 2022 10:40
>
> This commit removes warning generated by cocci as follows:
>
> do_div() does a 64-by-32 division, please consider using div64_u64 instead.
>
> Using div64_u64 instead of do_div can avoid potential truncation.
Cocci is lying to you.
do_div() exists because a 64 by 32 bit divide is significantly
faster than a 64 by 64 divide.
This is particularly true on 32bit cpu, but is also true on
Intel x86_64 bit cpu.
So unless the result might actually be larger than 32 bits
(which requires code analysis) then do_div() is correct.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists