block: make /sys/block/<dev>/queue/discard_max_bytes writeable
Quoted 9 lines · Dan Carpenter
Hello Jens Axboe,
The patch
d45a0f150e9d: "block: make /sys/block/<dev>/queue/discard_max_bytes writeable" from Jul 16, 2015, leads to the following static checker warning:block/blk-sysfs.c:152 queue_discard_max_hw_show() warn: should 'q->limits.max_hw_discard_sectors << 9' be a 64 bit type?
Quoted 8 lines
block/blk-sysfs.c148 static ssize_t queue_discard_max_hw_show(struct request_queue *q, char *page) 149 { 150 unsigned long long val; 151 152 val = q->limits.max_hw_discard_sectors << 9; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^It definitely looks like this can wrap.
Yeah it can, that should be cast to unsigned long long for the shift. I'll make that change.
Signature · 1 line
Jens Axboe
Hello Jens Axboe,
The patch d45a0f150e9d: "block: make /sys/block/<dev>/queue/discard_max_bytes writeable" from Jul 16, 2015, leads to the following static checker warning:
block/blk-sysfs.c:152 queue_discard_max_hw_show() warn: should 'q->limits.max_hw_discard_sectors << 9' be a 64 bit type?
block/blk-sysfs.c
148 static ssize_t queue_discard_max_hw_show(struct request_queue *q, char *page) 149 {
150 unsigned long long val;
151
152 val = q->limits.max_hw_discard_sectors << 9;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^It definitely looks like this can wrap.
153 return sprintf(page, "%llu\n", val); 154 }
regards,
dan carpenter