1
0
Fork 0

blk-mq: make sure that line break can be printed

8962842ca5 ("blk-mq: avoid sysfs buffer overflow with too many CPU cores")
avoids sysfs buffer overflow, and reserves one character for line break.
However, the last snprintf() doesn't get correct 'size' parameter passed
in, so fixed it.

Fixes: 8962842ca5 ("blk-mq: avoid sysfs buffer overflow with too many CPU cores")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
alistair/sunxi64-5.5-dsi
Ming Lei 2019-11-04 16:26:53 +08:00 committed by Jens Axboe
parent 62c441c6ae
commit d2c9be89f8
1 changed files with 1 additions and 1 deletions

View File

@ -175,7 +175,7 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
pos += ret;
}
ret = snprintf(pos + page, size - pos, "\n");
ret = snprintf(pos + page, size + 1 - pos, "\n");
return pos + ret;
}