From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, T_DKIMWL_WL_HIGH,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21BD1C004C9 for ; Tue, 7 May 2019 05:44:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DBC0620675 for ; Tue, 7 May 2019 05:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557207876; bh=ol/OGDo+tUgXh3YHyIMGV+8+672D7lyX3eZgM7xXpUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ktfmlr84A8THuEAl5IWiNRD83+Ov8EUNPLxlfmRl7ItKfmdYNZZKgr8c6Gvsk1nt3 HSJDdn2E3cDGeSYejpE5NvChBqa6nwzpfN8OB6xyWD4O7vXtKcq4+VyOlmkSJ5U+A0 Avzh2DR4DMsY8Z5I1jQH5ixiePJKQaN11PGuUc1M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729604AbfEGFme (ORCPT ); Tue, 7 May 2019 01:42:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:33366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729548AbfEGFmZ (ORCPT ); Tue, 7 May 2019 01:42:25 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9E6DE20675; Tue, 7 May 2019 05:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557207744; bh=ol/OGDo+tUgXh3YHyIMGV+8+672D7lyX3eZgM7xXpUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvUDCi1oGc/+zPflrSOVNFU8y0ixnMDxGPES9pl5uAk/+dLI5aTvM3wzGspFYFJzj FcfEvmEpX5PXaQzjuB3e9aytrfFxgAoqu+52WC5oXjgqH1NvBoxTBzPIkbKqrSkw+I 56tTWKHnQIkm6iK4nFUG9w6qddOKDwOmAZqzAiEc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Oberparleiter , Stefan Haberland , Martin Schwidefsky , Sasha Levin , linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 05/14] s390/dasd: Fix capacity calculation for large volumes Date: Tue, 7 May 2019 01:42:07 -0400 Message-Id: <20190507054218.340-5-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190507054218.340-1-sashal@kernel.org> References: <20190507054218.340-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Oberparleiter [ 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 80a43074c2f9..c530610f61ac 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -2066,14 +2066,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