[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <55E81CB2-AB4B-41E2-88D5-B33F7D8B1DB8@cam.ac.uk>
Date: Mon, 22 Sep 2014 16:29:56 +0100
From: Anton Altaparmakov <aia21@....ac.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Hugh Dickins <hughd@...gle.com>,
stable <stable@...r.kernel.org>
Subject: Re: [PATCH] Fix nasty 32-bit overflow bug in buffer i/o code.
Hi Linus,
On 22 Sep 2014, at 16:18, Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Sun, Sep 21, 2014 at 5:53 PM, Anton Altaparmakov <aia21@....ac.uk> wrote:
>>
>> This patch fixes this issue by type casting "index" to sector_t before
>> doing the left shift.
>
> Ugh. Does the simpler patch to just pass in "block" work as well?
That doesn't work because nothing rounds down "block" to the first block in the page and init_page_buffers() requires "block" to be the first block in the page.
The shift right followed by shift left achieves the "rounding down" required.
You could do "block & ~(sector_t)(size - 1)" instead of "(sector_t)index << sizebits" if you prefer but not sure that is an improvement!
Best regards,
Anton
> Linus
> <patch.diff>
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
University of Cambridge Information Services, Roger Needham Building
7 JJ Thomson Avenue, Cambridge, CB3 0RB, UK
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists