On Thu, Jan 05, 2023 at 01:28:35PM -0800, Bart Van Assche wrote: > On 1/5/23 12:51, Keith Busch wrote: > > diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c > > index 93d9e9c9a6ea8..5486b6c57f6b8 100644 > > --- a/block/blk-sysfs.c > > +++ b/block/blk-sysfs.c > > @@ -239,19 +239,28 @@ static ssize_t queue_zone_append_max_show(struct request_queue *q, char *page) > > static ssize_t > > queue_max_sectors_store(struct request_queue *q, const char *page, size_t count) > > { > > - unsigned long max_sectors_kb, > > + unsigned long var; > > + unsigned int max_sectors_kb, > > max_hw_sectors_kb = queue_max_hw_sectors(q) >> 1, > > page_kb = 1 << (PAGE_SHIFT - 10); > > - ssize_t ret = queue_var_store(&max_sectors_kb, page, count); > > + ssize_t ret = queue_var_store(&var, page, count); > > if (ret < 0) > > return ret; > > - max_hw_sectors_kb = min_not_zero(max_hw_sectors_kb, (unsigned long) > > + max_sectors_kb = (unsigned int)var; > > Shouldn't this function report an error if 'var' is too large to fit into an > unsigned int? Yes it should, and queue_var_store() will return -EINVAL if that happens. That's certainly not clear just from reading this patch, but the condition is handled.