Mailing List Archive

[PATCH 12/45] block: remove a superflous check in blkpg_do_ioctl
sector_t is now always a u64, so this check is not needed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/ioctl.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/block/ioctl.c b/block/ioctl.c
index 6b785181344fe1..0c09bb7a6ff35f 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -35,15 +35,6 @@ static int blkpg_do_ioctl(struct block_device *bdev,
start = p.start >> SECTOR_SHIFT;
length = p.length >> SECTOR_SHIFT;

- /* check for fit in a hd_struct */
- if (sizeof(sector_t) < sizeof(long long)) {
- long pstart = start, plength = length;
-
- if (pstart != start || plength != length || pstart < 0 ||
- plength < 0 || p.pno > 65535)
- return -EINVAL;
- }
-
switch (op) {
case BLKPG_ADD_PARTITION:
/* check if partition is aligned to blocksize */
--
2.29.2
Re: [PATCH 12/45] block: remove a superflous check in blkpg_do_ioctl [ In reply to ]
On Tue, Nov 24, 2020 at 02:27:18PM +0100, Christoph Hellwig wrote:
> sector_t is now always a u64, so this check is not needed.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Tejun Heo <tj@kernel.org>

--
tejun
Re: [PATCH 12/45] block: remove a superflous check in blkpg_do_ioctl [ In reply to ]
On Tue 24-11-20 14:27:18, Christoph Hellwig wrote:
> sector_t is now always a u64, so this check is not needed.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

Honza

> ---
> block/ioctl.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/block/ioctl.c b/block/ioctl.c
> index 6b785181344fe1..0c09bb7a6ff35f 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -35,15 +35,6 @@ static int blkpg_do_ioctl(struct block_device *bdev,
> start = p.start >> SECTOR_SHIFT;
> length = p.length >> SECTOR_SHIFT;
>
> - /* check for fit in a hd_struct */
> - if (sizeof(sector_t) < sizeof(long long)) {
> - long pstart = start, plength = length;
> -
> - if (pstart != start || plength != length || pstart < 0 ||
> - plength < 0 || p.pno > 65535)
> - return -EINVAL;
> - }
> -
> switch (op) {
> case BLKPG_ADD_PARTITION:
> /* check if partition is aligned to blocksize */
> --
> 2.29.2
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR