Skip to content

Commit

Permalink
[PATCH] Add missing overflow check in get_blkdev_list
Browse files Browse the repository at this point in the history
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 <nhorman@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Neil Horman authored and Linus Torvalds committed Sep 7, 2005
1 parent f23ef18 commit f62c6d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit f62c6d0

Please sign in to comment.