Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp489507yba; Wed, 15 May 2019 05:04:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpSS2C12xpTKmmqwhgVlaOx4Lcgf3MQBlijAx0GelEP7VY/Chz87rcTeaaIsH6Wux4JPnf X-Received: by 2002:a62:4281:: with SMTP id h1mr46510577pfd.162.1557921844294; Wed, 15 May 2019 05:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557921844; cv=none; d=google.com; s=arc-20160816; b=INJQPUbl0xF72i0UmYJo5C3W2HHEx0PohSVP2c8OpbpmbE3/98LlwLYvarA7WtfU6V 7DbmYhmCn0bgd5QoirapoT17FLf4VQj+0K7cpZlIp/uLSPSVLN4Cd3dyZMETjOjy+EXr NfNVaMNfqrSRW4fmIirL3Z9kzjxn7mYxiMU21HmMP6zqbYeTFKCZh9f1JMBXr88IXKQl 6kpJ4pm8I2RznjoxDuLHuRRQkqWPzP5w0tl8d22fhLoOnGtnKMmJPinQxIhrYYgvW1np xhleMERucCeK/+fsd4qbBDcfjVIe8hqc8Ym8bpEtTAEiJswgNEOoEWB0kHovXOoYFJoY t+YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TRJY04F1G+irDgd6GsmzqsZm6faQ+7PRKb+bQrVfaRU=; b=flFdkFd00yYMDuOrvhhxJEGHMCQxjH96j4TC/vW8dAHq0ZFM5DabZonsCFezswnChv F3DpxrsgL4dCwSS6OcupNsiSUB3j/NDfwe6L8tMBeyCbUIRuqjGbN2YtYjiq33Rm7/GR 6pe1N6U7jOO8AaU4Mpvwby1mc3YPuy0dQhq4rfiPBALwLckoboZmTYZTR2YcL6coHxZO vWGbJWxXesjkI74UCl6ur6StkV7ByEjUvHCSvIsLIDAIDbrUw3yUlY+upXOrwbaCAeMz dm90jZkH0czNLB/ARtbYs0tInWuCea1EpztdwcwkepyfPR4yK8Lw2ivMwDm/yl6RUE+E alyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vpVtMcaH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si1637237pgj.312.2019.05.15.05.03.46; Wed, 15 May 2019 05:04:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vpVtMcaH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730458AbfEOMBy (ORCPT + 99 others); Wed, 15 May 2019 08:01:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:49392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729761AbfEOLNk (ORCPT ); Wed, 15 May 2019 07:13:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B70B620644; Wed, 15 May 2019 11:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557918819; bh=Nc2YgTqwsgxczvB4E+Mh1BjslV4IUV3hlHpngQqXUok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vpVtMcaHYWmdb7QgX+VOragxAbY/uMYauvK2OE334TzBJgxB2gpd7unojAUOio3GI zXCOXjQQoPf8QN79AdnnXiDX0xetZvJYhG7Fk7DsKlozN1Vmp4PNzeb7DJe78Onwkw 3UQtkJY1zY3XjR0CSL6sCya6M+ZHvJq3rvUKsllQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Oberparleiter , Stefan Haberland , Martin Schwidefsky , Sasha Levin Subject: [PATCH 4.9 12/51] s390/dasd: Fix capacity calculation for large volumes Date: Wed, 15 May 2019 12:55:47 +0200 Message-Id: <20190515090621.135203735@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090616.669619870@linuxfoundation.org> References: <20190515090616.669619870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 2cc9637ce825f3a9f51f8f78af7474e9e85bfa5f ] The DASD driver incorrectly limits the maximum number of blocks of ECKD DASD volumes to 32 bit numbers. Volumes with a capacity greater than 2^32-1 blocks are incorrectly recognized as smaller volumes. This results in the following volume capacity limits depending on the formatted block size: BLKSIZE MAX_GB MAX_CYL 512 2047 5843492 1024 4095 8676701 2048 8191 13634816 4096 16383 23860929 The same problem occurs when a volume with more than 17895697 cylinders is accessed in raw-track-access mode. Fix this problem by adding an explicit type cast when calculating the maximum number of blocks. Signed-off-by: Peter Oberparleiter Reviewed-by: Stefan Haberland Signed-off-by: Martin Schwidefsky Signed-off-by: Sasha Levin --- drivers/s390/block/dasd_eckd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 11c6335b19516..9d772201e3347 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -2054,14 +2054,14 @@ static int dasd_eckd_end_analysis(struct dasd_block *block) blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); raw: - block->blocks = (private->real_cyl * + block->blocks = ((unsigned long) private->real_cyl * private->rdc_data.trk_per_cyl * blk_per_trk); dev_info(&device->cdev->dev, - "DASD with %d KB/block, %d KB total size, %d KB/track, " + "DASD with %u KB/block, %lu KB total size, %u KB/track, " "%s\n", (block->bp_block >> 10), - ((private->real_cyl * + (((unsigned long) private->real_cyl * private->rdc_data.trk_per_cyl * blk_per_trk * (block->bp_block >> 9)) >> 1), ((blk_per_trk * block->bp_block) >> 10), -- 2.20.1