From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754273AbaIVPd5 (ORCPT ); Mon, 22 Sep 2014 11:33:57 -0400 Received: from mail-vc0-f182.google.com ([209.85.220.182]:47477 "EHLO mail-vc0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753998AbaIVPdz (ORCPT ); Mon, 22 Sep 2014 11:33:55 -0400 MIME-Version: 1.0 In-Reply-To: <55E81CB2-AB4B-41E2-88D5-B33F7D8B1DB8@cam.ac.uk> References: <55E81CB2-AB4B-41E2-88D5-B33F7D8B1DB8@cam.ac.uk> Date: Mon, 22 Sep 2014 08:33:54 -0700 X-Google-Sender-Auth: m0CECRao61gAYe-1QVGVW7Tokcs Message-ID: Subject: Re: [PATCH] Fix nasty 32-bit overflow bug in buffer i/o code. From: Linus Torvalds To: Anton Altaparmakov Cc: Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , Hugh Dickins , stable Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 22, 2014 at 8:29 AM, Anton Altaparmakov 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