linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Guohua Zhong' <zhongguohua1@huawei.com>,
	"paubert@iram.es" <paubert@iram.es>
Cc: "wangle6@huawei.com" <wangle6@huawei.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"paulus@samba.org" <paulus@samba.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"nixiaoming@huawei.com" <nixiaoming@huawei.com>
Subject: RE: Re:Re: [PATCH] powerpc: Fix a bug in __div64_32 if divisor is zero
Date: Mon, 24 Aug 2020 15:05:13 +0000	[thread overview]
Message-ID: <c200b38836674bbbb928bf76cbb978f1@AcuMS.aculab.com> (raw)
In-Reply-To: <20200824132539.35972-1-zhongguohua1@huawei.com>

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)

  reply	other threads:[~2020-08-24 15:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 13:10 [PATCH] powerpc: Fix a bug in __div64_32 if divisor is zero Guohua Zhong
2020-08-20 17:02 ` Christophe Leroy
2020-08-22 16:29   ` Guohua Zhong
2020-08-20 18:23 ` Christophe Leroy
2020-08-22 16:54   ` Re:Re: " Guohua Zhong
2020-08-22 17:25     ` Gabriel Paubert
2020-08-24 13:25       ` Guohua Zhong
2020-08-24 15:05         ` David Laight [this message]
2020-08-23  0:11     ` Segher Boessenkool
2020-08-24 11:54       ` Guohua Zhong
2020-08-24 18:17         ` Segher Boessenkool
2020-08-22 16:06 ` Guohua Zhong

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=c200b38836674bbbb928bf76cbb978f1@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nixiaoming@huawei.com \
    --cc=paubert@iram.es \
    --cc=paulus@samba.org \
    --cc=stable@vger.kernel.org \
    --cc=wangle6@huawei.com \
    --cc=zhongguohua1@huawei.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;
as well as URLs for NNTP newsgroup(s).