From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Peter Oberparleiter <oberpar@linux.ibm.com>,
Stefan Haberland <sth@linux.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Sasha Levin <sashal@kernel.org>,
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 [thread overview]
Message-ID: <20190507054218.340-5-sashal@kernel.org> (raw)
In-Reply-To: <20190507054218.340-1-sashal@kernel.org>
From: Peter Oberparleiter <oberpar@linux.ibm.com>
[ 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 <oberpar@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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
next prev parent reply other threads:[~2019-05-07 5:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 5:42 [PATCH AUTOSEL 4.4 01/14] iio: adc: xilinx: fix potential use-after-free on remove Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 02/14] HID: input: add mapping for Expose/Overview key Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 03/14] HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 04/14] libnvdimm/btt: Fix a kmemdup failure check Sasha Levin
2019-05-07 5:42 ` Sasha Levin
2019-05-07 5:42 ` Sasha Levin [this message]
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 06/14] Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 07/14] s390/3270: fix lockdep false positive on view->lock Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 08/14] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 09/14] tools lib traceevent: Fix missing equality check for strcmp Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 10/14] init: initialize jump labels before command line option parsing Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 11/14] ipvs: do not schedule icmp errors from tunnels Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 12/14] s390: ctcm: fix ctcm_new_device error return code Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 13/14] selftests/net: correct the return value for run_netsocktests sashal
2019-05-07 5:42 ` Sasha Levin
2019-05-07 5:42 ` Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 4.4 14/14] gpu: ipu-v3: dp: fix CSC handling Sasha Levin
2019-05-07 5:42 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190507054218.340-5-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=oberpar@linux.ibm.com \
--cc=schwidefsky@de.ibm.com \
--cc=stable@vger.kernel.org \
--cc=sth@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.