]> git.itanic.dy.fi Git - linux-stable/commit
s390/dasd: Fix capacity calculation for large volumes
authorPeter Oberparleiter <oberpar@linux.ibm.com>
Fri, 22 Mar 2019 15:01:17 +0000 (16:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 May 2019 07:17:22 +0000 (09:17 +0200)
commit2f922c459f4872fd1f881c42ab42a1934b97288e
treeaaf6c087afa44911f8d2b3ea93875ca977b815a7
parente172a3b5909881ecef5fc4abcf751c46a2c71dcc
s390/dasd: Fix capacity calculation for large volumes

[ 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