aboutsummaryrefslogtreecommitdiffstats
path: root/block/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/ioctl.c')
-rw-r--r--block/ioctl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index cc46d499fd27..fefa9a496708 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -125,7 +125,7 @@ static int blk_ioctl_discard(struct block_device *bdev, uint64_t start,
125 start >>= 9; 125 start >>= 9;
126 len >>= 9; 126 len >>= 9;
127 127
128 if (start + len > (bdev->bd_inode->i_size >> 9)) 128 if (start + len > (i_size_read(bdev->bd_inode) >> 9))
129 return -EINVAL; 129 return -EINVAL;
130 if (secure) 130 if (secure)
131 flags |= BLKDEV_DISCARD_SECURE; 131 flags |= BLKDEV_DISCARD_SECURE;
@@ -242,6 +242,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
242 * We need to set the startsect first, the driver may 242 * We need to set the startsect first, the driver may
243 * want to override it. 243 * want to override it.
244 */ 244 */
245 memset(&geo, 0, sizeof(geo));
245 geo.start = get_start_sect(bdev); 246 geo.start = get_start_sect(bdev);
246 ret = disk->fops->getgeo(bdev, &geo); 247 ret = disk->fops->getgeo(bdev, &geo);
247 if (ret) 248 if (ret)
@@ -308,12 +309,12 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
308 ret = blkdev_reread_part(bdev); 309 ret = blkdev_reread_part(bdev);
309 break; 310 break;
310 case BLKGETSIZE: 311 case BLKGETSIZE:
311 size = bdev->bd_inode->i_size; 312 size = i_size_read(bdev->bd_inode);
312 if ((size >> 9) > ~0UL) 313 if ((size >> 9) > ~0UL)
313 return -EFBIG; 314 return -EFBIG;
314 return put_ulong(arg, size >> 9); 315 return put_ulong(arg, size >> 9);
315 case BLKGETSIZE64: 316 case BLKGETSIZE64:
316 return put_u64(arg, bdev->bd_inode->i_size); 317 return put_u64(arg, i_size_read(bdev->bd_inode));
317 case BLKTRACESTART: 318 case BLKTRACESTART:
318 case BLKTRACESTOP: 319 case BLKTRACESTOP:
319 case BLKTRACESETUP: 320 case BLKTRACESETUP: