[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c200b38836674bbbb928bf76cbb978f1@AcuMS.aculab.com>
Date: Mon, 24 Aug 2020 15:05:13 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Guohua Zhong' <zhongguohua1@...wei.com>,
"paubert@...m.es" <paubert@...m.es>
CC: "christophe.leroy@...roup.eu" <christophe.leroy@...roup.eu>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"nixiaoming@...wei.com" <nixiaoming@...wei.com>,
"paulus@...ba.org" <paulus@...ba.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"wangle6@...wei.com" <wangle6@...wei.com>
Subject: RE: Re:Re: [PATCH] powerpc: Fix a bug in __div64_32 if divisor is zero
From: Guohua Zhong
> Sent: 24 August 2020 14:26
>
> >> >In generic version in lib/math/div64.c, there is no checking of 'base'
> >> >either.
> >> >Do we really want to add this check in the powerpc version only ?
> >>
> >> >The only user of __div64_32() is do_div() in
> >> >include/asm-generic/div64.h. Wouldn't it be better to do the check there ?
> >>
> >> >Christophe
> >>
> >> Yet, I have noticed that there is no checking of 'base' in these functions.
> >> But I am not sure how to check is better.As we know that the result is
> >> undefined when divisor is zero. It maybe good to print error and dump stack.
I thought that the onus was put on the caller to avoid divide by zero.
On x86 divide by zero causes an exception which (I'm pretty sure)
leads to a oops/panic.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists