aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2006-12-06 23:37:04 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:35 -0500
commit4a6e617a4bec9fb2ee4a16cf59565b2af5049e12 (patch)
tree4d69b8da779c58b506efe8f3fcae48d7b3c7bb4d
parente0980dafa329d33bb88edc8a3ef9fab4e070590c (diff)
[PATCH] fs/*: trivial vsnprintf() conversion
It would very lame to get buffer overflow via one of the following. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Cc: Mark Fasheh <mark.fasheh@oracle.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/adfs/super.c2
-rw-r--r--fs/affs/amigaffs.c4
-rw-r--r--fs/jfs/super.c2
-rw-r--r--fs/ocfs2/super.c4
-rw-r--r--fs/udf/super.c4
-rw-r--r--fs/ufs/super.c6
6 files changed, 11 insertions, 11 deletions
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index e5a205c9f42f..5023351a7afe 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -36,7 +36,7 @@ void __adfs_error(struct super_block *sb, const char *function, const char *fmt,
36 va_list args; 36 va_list args;
37 37
38 va_start(args, fmt); 38 va_start(args, fmt);
39 vsprintf(error_buf, fmt, args); 39 vsnprintf(error_buf, sizeof(error_buf), fmt, args);
40 va_end(args); 40 va_end(args);
41 41
42 printk(KERN_CRIT "ADFS-fs error (device %s)%s%s: %s\n", 42 printk(KERN_CRIT "ADFS-fs error (device %s)%s%s: %s\n",
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index ccd624ef4272..f4de4b98004f 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -445,7 +445,7 @@ affs_error(struct super_block *sb, const char *function, const char *fmt, ...)
445 va_list args; 445 va_list args;
446 446
447 va_start(args,fmt); 447 va_start(args,fmt);
448 vsprintf(ErrorBuffer,fmt,args); 448 vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args);
449 va_end(args); 449 va_end(args);
450 450
451 printk(KERN_CRIT "AFFS error (device %s): %s(): %s\n", sb->s_id, 451 printk(KERN_CRIT "AFFS error (device %s): %s(): %s\n", sb->s_id,
@@ -461,7 +461,7 @@ affs_warning(struct super_block *sb, const char *function, const char *fmt, ...)
461 va_list args; 461 va_list args;
462 462
463 va_start(args,fmt); 463 va_start(args,fmt);
464 vsprintf(ErrorBuffer,fmt,args); 464 vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args);
465 va_end(args); 465 va_end(args);
466 466
467 printk(KERN_WARNING "AFFS warning (device %s): %s(): %s\n", sb->s_id, 467 printk(KERN_WARNING "AFFS warning (device %s): %s(): %s\n", sb->s_id,
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index ca3e19128532..846ac8f34513 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -93,7 +93,7 @@ void jfs_error(struct super_block *sb, const char * function, ...)
93 va_list args; 93 va_list args;
94 94
95 va_start(args, function); 95 va_start(args, function);
96 vsprintf(error_buf, function, args); 96 vsnprintf(error_buf, sizeof(error_buf), function, args);
97 va_end(args); 97 va_end(args);
98 98
99 printk(KERN_ERR "ERROR: (device %s): %s\n", sb->s_id, error_buf); 99 printk(KERN_ERR "ERROR: (device %s): %s\n", sb->s_id, error_buf);
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 0524f8a04ad6..4bf39540e652 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1674,7 +1674,7 @@ void __ocfs2_error(struct super_block *sb,
1674 va_list args; 1674 va_list args;
1675 1675
1676 va_start(args, fmt); 1676 va_start(args, fmt);
1677 vsprintf(error_buf, fmt, args); 1677 vsnprintf(error_buf, sizeof(error_buf), fmt, args);
1678 va_end(args); 1678 va_end(args);
1679 1679
1680 /* Not using mlog here because we want to show the actual 1680 /* Not using mlog here because we want to show the actual
@@ -1695,7 +1695,7 @@ void __ocfs2_abort(struct super_block* sb,
1695 va_list args; 1695 va_list args;
1696 1696
1697 va_start(args, fmt); 1697 va_start(args, fmt);
1698 vsprintf(error_buf, fmt, args); 1698 vsnprintf(error_buf, sizeof(error_buf), fmt, args);
1699 va_end(args); 1699 va_end(args);
1700 1700
1701 printk(KERN_CRIT "OCFS2: abort (device %s): %s: %s\n", 1701 printk(KERN_CRIT "OCFS2: abort (device %s): %s: %s\n",
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 397f54aaf667..1dbc2955f02e 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1709,7 +1709,7 @@ void udf_error(struct super_block *sb, const char *function,
1709 sb->s_dirt = 1; 1709 sb->s_dirt = 1;
1710 } 1710 }
1711 va_start(args, fmt); 1711 va_start(args, fmt);
1712 vsprintf(error_buf, fmt, args); 1712 vsnprintf(error_buf, sizeof(error_buf), fmt, args);
1713 va_end(args); 1713 va_end(args);
1714 printk (KERN_CRIT "UDF-fs error (device %s): %s: %s\n", 1714 printk (KERN_CRIT "UDF-fs error (device %s): %s: %s\n",
1715 sb->s_id, function, error_buf); 1715 sb->s_id, function, error_buf);
@@ -1721,7 +1721,7 @@ void udf_warning(struct super_block *sb, const char *function,
1721 va_list args; 1721 va_list args;
1722 1722
1723 va_start (args, fmt); 1723 va_start (args, fmt);
1724 vsprintf(error_buf, fmt, args); 1724 vsnprintf(error_buf, sizeof(error_buf), fmt, args);
1725 va_end(args); 1725 va_end(args);
1726 printk(KERN_WARNING "UDF-fs warning (device %s): %s: %s\n", 1726 printk(KERN_WARNING "UDF-fs warning (device %s): %s: %s\n",
1727 sb->s_id, function, error_buf); 1727 sb->s_id, function, error_buf);
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 0b18d2cc2efa..8a8e9382ec09 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -224,7 +224,7 @@ void ufs_error (struct super_block * sb, const char * function,
224 sb->s_flags |= MS_RDONLY; 224 sb->s_flags |= MS_RDONLY;
225 } 225 }
226 va_start (args, fmt); 226 va_start (args, fmt);
227 vsprintf (error_buf, fmt, args); 227 vsnprintf (error_buf, sizeof(error_buf), fmt, args);
228 va_end (args); 228 va_end (args);
229 switch (UFS_SB(sb)->s_mount_opt & UFS_MOUNT_ONERROR) { 229 switch (UFS_SB(sb)->s_mount_opt & UFS_MOUNT_ONERROR) {
230 case UFS_MOUNT_ONERROR_PANIC: 230 case UFS_MOUNT_ONERROR_PANIC:
@@ -255,7 +255,7 @@ void ufs_panic (struct super_block * sb, const char * function,
255 sb->s_dirt = 1; 255 sb->s_dirt = 1;
256 } 256 }
257 va_start (args, fmt); 257 va_start (args, fmt);
258 vsprintf (error_buf, fmt, args); 258 vsnprintf (error_buf, sizeof(error_buf), fmt, args);
259 va_end (args); 259 va_end (args);
260 sb->s_flags |= MS_RDONLY; 260 sb->s_flags |= MS_RDONLY;
261 printk (KERN_CRIT "UFS-fs panic (device %s): %s: %s\n", 261 printk (KERN_CRIT "UFS-fs panic (device %s): %s: %s\n",
@@ -268,7 +268,7 @@ void ufs_warning (struct super_block * sb, const char * function,
268 va_list args; 268 va_list args;
269 269
270 va_start (args, fmt); 270 va_start (args, fmt);
271 vsprintf (error_buf, fmt, args); 271 vsnprintf (error_buf, sizeof(error_buf), fmt, args);
272 va_end (args); 272 va_end (args);
273 printk (KERN_WARNING "UFS-fs warning (device %s): %s: %s\n", 273 printk (KERN_WARNING "UFS-fs warning (device %s): %s: %s\n",
274 sb->s_id, function, error_buf); 274 sb->s_id, function, error_buf);