Re: [PATCH] Fix nasty 32-bit overflow bug in buffer i/o code.
From: Linus Torvalds
Date: Mon Sep 22 2014 - 11:34:00 EST
On Mon, Sep 22, 2014 at 8:29 AM, Anton Altaparmakov <aia21@xxxxxxxxx> wrote:
>
> You could do "block & ~(sector_t)(size - 1)" instead of "(sector_t)index << sizebits" if you prefer but not sure that is an improvement!
No, it would be even worse. Something like
block & ~(sector_t)((size >> 9) - 1)
because block is the sector number (ie 512-byte) and size is in bytes.
Linus
--
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/