diff options
author | Coly Li <[email protected]> | 2020-07-25 20:00:21 +0800 |
---|---|---|
committer | Jens Axboe <[email protected]> | 2020-07-25 07:38:20 -0600 |
commit | 65f0f017e7be8c70330372df23bcb2a407ecf02d (patch) | |
tree | 045f0bed9e860961cc83ef9b2cd821a9ba35de13 /tools/perf/util/scripting-engines/trace-event-python.c | |
parent | 29f1d5caced9c2db96f169422bade787ff45d584 (diff) |
bcache: avoid nr_stripes overflow in bcache_device_init()
For some block devices which large capacity (e.g. 8TB) but small io_opt
size (e.g. 8 sectors), in bcache_device_init() the stripes number calcu-
lated by,
DIV_ROUND_UP_ULL(sectors, d->stripe_size);
might be overflow to the unsigned int bcache_device->nr_stripes.
This patch uses the uint64_t variable to store DIV_ROUND_UP_ULL()
and after the value is checked to be available in unsigned int range,
sets it to bache_device->nr_stripes. Then the overflow is avoided.
Reported-and-tested-by: Ken Raeburn <[email protected]>
Signed-off-by: Coly Li <[email protected]>
Cc: [email protected]
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783075
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
0 files changed, 0 insertions, 0 deletions