Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751620AbdIMRSY (ORCPT ); Wed, 13 Sep 2017 13:18:24 -0400 Received: from mail-it0-f49.google.com ([209.85.214.49]:45004 "EHLO mail-it0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751588AbdIMRSW (ORCPT ); Wed, 13 Sep 2017 13:18:22 -0400 X-Google-Smtp-Source: AOwi7QCHKT6q94Mj3GrkeAAq5gYxEmwgEayCJRN4wTYWlYTMMpuozpZDVQs9y95olK7mS0LlwPbmrQ== Subject: Re: [PATCH] brd: fix overflow in __brd_direct_access To: Mikulas Patocka , Dan Williams Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: From: Jens Axboe Message-ID: Date: Wed, 13 Sep 2017 11:18:18 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 447 Lines: 13 On 09/13/2017 07:17 AM, Mikulas Patocka wrote: > The code in __brd_direct_access multiplies the pgoff variable by page size > and divides it by 512. It can cause overflow on 32-bit architectures. The > overflow happens if we create ramdisk larger than 4G and use it as a > sparse device. > > This patch replaces multiplication and division with multiplication by the > number of sectors per page. Thanks, applied with Dan's ack. -- Jens Axboe