summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2019-11-04 16:26:53 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-17 20:39:59 +0100
commitc499f898286777653deac3d47885aa95ffad1046 (patch)
tree224ba835d47923f7cfa59ec75fd4965ce6721eca /block
parentdca66097c0187a3b8e301991873eb5007f6cfae6 (diff)
downloadlinux-stable-c499f898286777653deac3d47885aa95ffad1046.tar.gz
linux-stable-c499f898286777653deac3d47885aa95ffad1046.tar.bz2
linux-stable-c499f898286777653deac3d47885aa95ffad1046.zip
blk-mq: make sure that line break can be printed
commit d2c9be89f8ebe7ebcc97676ac40f8dec1cf9b43a upstream. 8962842ca5ab ("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: 8962842ca5ab ("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> Cc: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq-sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index de733e8cab2e..c97fafa1b206 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -162,7 +162,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;
}