Skip to content

Commit d2c9be8

Browse files
Ming Leiaxboe
authored andcommitted
blk-mq: make sure that line break can be printed
8962842 ("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: 8962842 ("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>
1 parent 62c441c commit d2c9be8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎block/blk-mq-sysfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
175175
pos += ret;
176176
}
177177

178-
ret = snprintf(pos + page, size - pos, "\n");
178+
ret = snprintf(pos + page, size + 1 - pos, "\n");
179179
return pos + ret;
180180
}
181181

0 commit comments

Comments
 (0)