diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/char_dev.c | 13 | ||||
-rw-r--r-- | fs/proc/proc_misc.c | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c index c1e3537909fc..e82aac9cc2f5 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -56,10 +56,21 @@ int get_chrdev_list(char *page) | |||
56 | 56 | ||
57 | down(&chrdevs_lock); | 57 | down(&chrdevs_lock); |
58 | for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) { | 58 | for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) { |
59 | for (cd = chrdevs[i]; cd; cd = cd->next) | 59 | for (cd = chrdevs[i]; cd; cd = cd->next) { |
60 | /* | ||
61 | * if the current name, plus the 5 extra characters | ||
62 | * in the device line for this entry | ||
63 | * would run us off the page, we're done | ||
64 | */ | ||
65 | if ((len+strlen(cd->name) + 5) >= PAGE_SIZE) | ||
66 | goto page_full; | ||
67 | |||
68 | |||
60 | len += sprintf(page+len, "%3d %s\n", | 69 | len += sprintf(page+len, "%3d %s\n", |
61 | cd->major, cd->name); | 70 | cd->major, cd->name); |
71 | } | ||
62 | } | 72 | } |
73 | page_full: | ||
63 | up(&chrdevs_lock); | 74 | up(&chrdevs_lock); |
64 | 75 | ||
65 | return len; | 76 | return len; |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 63a9fbf1ac51..94b570ad037d 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -451,7 +451,7 @@ static int devices_read_proc(char *page, char **start, off_t off, | |||
451 | int count, int *eof, void *data) | 451 | int count, int *eof, void *data) |
452 | { | 452 | { |
453 | int len = get_chrdev_list(page); | 453 | int len = get_chrdev_list(page); |
454 | len += get_blkdev_list(page+len); | 454 | len += get_blkdev_list(page+len, len); |
455 | return proc_calc_metrics(page, start, off, count, eof, len); | 455 | return proc_calc_metrics(page, start, off, count, eof, len); |
456 | } | 456 | } |
457 | 457 | ||