Re: btrfs zero divide

From: Geert Uytterhoeven
Date: Tue Aug 13 2013 - 08:12:11 EST


On Fri, Aug 9, 2013 at 2:30 PM, Andreas Schwab <schwab@xxxxxxxxxxxxxx> wrote:
> Andreas Schwab <schwab@xxxxxxxxxxxxxx> writes:
>> Josef Bacik <jbacik@xxxxxxxxxxxx> writes:
>>> So stripe_len shouldn't be 0, if it is you have bigger problems :).

[ lost context: this is about the first do_div() in __btrfs_map_block() ]

>> The bigger problem is that stripe_nr is u64, this is completely bogus.
>> The first operand of do_div must be u32. This goes through the whole
>> file.
>
> Of course, what I meant was that the *second* operand must be u32, but
> that doesn't change my point.

I checked all do_div() implementations, and (unless I missed one) m68k and
mn10300 were the only two that didn't truncate base to 32 bits.

Mn10300 is little endian, so I think the problem won't happen there.

Andreas, I'll apply your patch
(http://permalink.gmane.org/gmane.linux.ports.m68k/5008)
with the crash log added to the commit message, so it's appropriate for -stable.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/