author: Neil Horman <nhorman@redhat.com> 2005-06-23 00:09:11 -0700
committer: Linus Torvalds <torvalds@ppc970.osdl.org> 2005-06-23 09:45:19 -0700
commit: ac20427ef6aa63da663bdc88b71d16f7394f5e23
parent: 3bc1ee3e8f1c05c0f64a479c6d56eb34a6190599
Commit Summary:
Diffstat:
1 file changed, 11 insertions, 1 deletion
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)
down(&chrdevs_lock);
for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) {
- for (cd = chrdevs[i]; cd; cd = cd->next)
+ for (cd = chrdevs[i]; cd; cd = cd->next) {
+ /*
+ * if the current name, plus the 5 extra characters
+ * in the device line for this entry
+ * would run us off the page, we're done
+ */
+ if ((len+strlen(cd->name) + 5) >= PAGE_SIZE)
+ goto page_full;
+
+
len += sprintf(page+len, "%3d %s\n",
cd->major, cd->name);
+ }
}
+page_full:
up(&chrdevs_lock);
return len;