Re: [PATCH] blk-throttle: fix divid e-by-zero on legacy iops limit of 0

Tao Cui <[email protected]>
Newsgroups org.kernel.vger.cgroups,org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

于 2026年7月15日 GMT+08:00 23:01:09,David Laight <[email protected]> 写道:
>On Wed, 15 Jul 2026 20:44:19 +0800
>Tao Cui <[email protected]> wrote:
>
>> 在 2026/7/14 19:37, David Laight 写道:
>...
>> >>  	tg_update_slice(tg, rw);
>> >> @@ -1386,7 +1391,8 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of,
>> >>  	if (is_u64)
>> >>  		*(u64 *)((void *)tg + of_cft(of)->private) = v;
>> >>  	else
>> >> -		*(unsigned int *)((void *)tg + of_cft(of)->private) = v;
>> >> +		*(unsigned int *)((void *)tg + of_cft(of)->private) =
>> >> +			min_t(u64, v, UINT_MAX);  
>> > 
>> > The LHS casts look horrid - there has to be a nicer way to do that.
>> > 
>> > And you don't need min_t() a plain min() will be fine.
>> >   
>> Hi David,
>> 
>> Both done in v2 — introduced a void *field local so the writes read
>> *(u64 *)field / *(unsigned int *)field, and switched to
>> min(v, (u64)UINT_MAX).
>
>You don't need the cast either.

Noted, this will be done in the next version.

Thanks,
Tao
>
>	David
>
>> 
>> Thanks,
>> Tao
>> > 	David
>> > 
>> > 
>> >   
>> >>  
>> >>  	tg_conf_updated(tg, false);
>> >>  	ret = 0;  
>> >   
>> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.