Skip to content

Commit

Permalink
blk: fix overflow in queue_discard_max_hw_show
Browse files Browse the repository at this point in the history
We get this right for queue_discard_max_show but not max_hw_show. Follow the
same pattern as queue_discard_max_show instead so that we don't truncate.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Alan authored and Jens Axboe committed Feb 17, 2016
1 parent 3d65ae4 commit 18f922d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions block/blk-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,9 @@ static ssize_t queue_discard_granularity_show(struct request_queue *q, char *pag

static ssize_t queue_discard_max_hw_show(struct request_queue *q, char *page)
{
unsigned long long val;

val = q->limits.max_hw_discard_sectors << 9;
return sprintf(page, "%llu\n", val);
return sprintf(page, "%llu\n",
(unsigned long long)q->limits.max_hw_discard_sectors << 9);
}

static ssize_t queue_discard_max_show(struct request_queue *q, char *page)
Expand Down

0 comments on commit 18f922d

Please sign in to comment.