Re: [Patch] blk-wbt: fix a divide-by-zero error in rwb_arm_timer()

2021-04-20 Thread Cong Wang
On Sat, Apr 17, 2021 at 9:41 PM Cong Wang wrote: > > From: Cong Wang > > We hit a divide error in rwb_arm_timer() and crash dump shows > rqd->scale_step is 16777215 (0xff in hex), so the expression > "(rqd->scale_step + 1) << 8)" is 0x1, which is just beyond > 32-bit integer range, he

[Patch] blk-wbt: fix a divide-by-zero error in rwb_arm_timer()

2021-04-17 Thread Cong Wang
From: Cong Wang We hit a divide error in rwb_arm_timer() and crash dump shows rqd->scale_step is 16777215 (0xff in hex), so the expression "(rqd->scale_step + 1) << 8)" is 0x1, which is just beyond 32-bit integer range, hence it is truncated to 0 and int_sqrt(0) returns 0 too, so we e