Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1590762
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings |
| Date | 2017-03-02 02:20 +0100 |
| Message-ID | <tgnzr-34a-7@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <tg9d8-1fv-21@gated-at.bofh.it> <tgdJM-4r7-19@gated-at.bofh.it> <tgemt-4Vt-9@gated-at.bofh.it> <tggeC-6gA-7@gated-at.bofh.it> <tgleh-1ix-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Mar 01, 2017 at 11:42:54PM +0100, Arnd Bergmann wrote: > On Wed, Mar 1, 2017 at 5:53 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote: > > On Wed, Mar 01, 2017 at 04:27:29PM +0100, Arnd Bergmann wrote: > > > I see no apparent reason for the ud2. > > It's the possible division by zero. This change would avoid the ud2: > > diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c > index db8e8b40569d..a2b09c518225 100644 > --- a/drivers/i2c/busses/i2c-img-scb.c > +++ b/drivers/i2c/busses/i2c-img-scb.c > @@ -1196,6 +1196,8 @@ static int img_i2c_init(struct img_i2c *i2c) > clk_khz /= prescale; > > /* Setup the clock increment value */ > + if (clk_khz < 1) > + clk_khz = 1; > inc = (256 * 16 * bitrate_khz) / clk_khz; > > /* Ok, I see what gcc is doing. clk_khz = clk_get_rate(i2c->scb_clk) / 1000; ... inc = (256 * 16 * bitrate_khz) / clk_khz; Because CONFIG_HAVE_CLK isn't set, clk_get_rate() returns 0, which means clk_khz is always zero, so the last statement *always* results in a divide-by-zero. So that looks like a bug in the code. However, I'm baffled by how gcc handles it. Instead of: a) reporting a compile-time warning/error; or b) letting the #DE (divide error) exception happen; it inserts a 'ud2', resulting in a #UD (invalid opcode). Why?!? -- Josh
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann <arnd@arndb.de> - 2017-03-01 10:40 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann <arnd@arndb.de> - 2017-03-01 11:00 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-01 15:50 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-01 18:30 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann <arnd@arndb.de> - 2017-03-01 23:10 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann <arnd@arndb.de> - 2017-03-01 23:50 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-02 02:20 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Ingo Molnar <mingo@kernel.org> - 2017-03-02 07:40 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Ingo Molnar <mingo@kernel.org> - 2017-03-02 15:00 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-02 15:30 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Ingo Molnar <mingo@kernel.org> - 2017-03-02 15:50 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-02 15:10 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann <arnd@arndb.de> - 2017-03-03 00:20 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-03 01:00 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann <arnd@arndb.de> - 2017-03-03 10:30 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann <arnd@arndb.de> - 2017-03-03 16:40 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann <arnd@arndb.de> - 2017-03-01 16:30 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-02 19:40 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Arnd Bergmann <arnd@arndb.de> - 2017-03-03 00:00 +0100
Re: [PATCH] objtool: fix another gcc jump table detection issue Arnd Bergmann <arnd@arndb.de> - 2017-03-03 00:10 +0100
[PATCH] objtool: fix another gcc jump table detection issue Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-03 04:20 +0100
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-01 16:30 +0100
csiph-web