From f62c6d0a2607b2d1fdf280d4d1467a7a6e24c67d Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 6 Sep 2005 15:17:30 -0700 Subject: [PATCH] [PATCH] Add missing overflow check in get_blkdev_list Patch to clean up missing overflow check in get_blkdev_list. The printf which adds the "Block Devices" string in /proc/devices can overflow the presented page if get_chrdev_list eats up the entire 4k space. Signed-off-by: Neil Horman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/genhd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c index 47fd3659a061..d42840cc0d1d 100644 --- a/drivers/block/genhd.c +++ b/drivers/block/genhd.c @@ -45,7 +45,7 @@ int get_blkdev_list(char *p, int used) struct blk_major_name *n; int i, len; - len = sprintf(p, "\nBlock devices:\n"); + len = snprintf(p, (PAGE_SIZE-used), "\nBlock devices:\n"); down(&block_subsys_sem); for (i = 0; i < ARRAY_SIZE(major_names); i++) { -- 2.20.1