diff options
author | Petr Mladek <pmladek@suse.cz> | 2014-04-03 17:48:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:21:07 -0400 |
commit | e8c42d36ab86cf45f88c3a0e344233b1032fbf3d (patch) | |
tree | 94fe60e04065bb06c1c83c68b8371dedc113cfc3 /kernel/printk | |
parent | c64730b26f08cccfbc8fcbf169c304b4bd71dcac (diff) |
printk: add comment about tricky check for text buffer size
There is no check for potential "text_len" overflow. It is not needed
because only valid level is detected. It took me some time to
understand why. It would deserve a comment ;-)
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Kay Sievers <kay@vrfy.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/printk.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index db7a02e05241..012f3e40671d 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -1561,6 +1561,11 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1561 | case 'd': /* KERN_DEFAULT */ | 1561 | case 'd': /* KERN_DEFAULT */ |
1562 | lflags |= LOG_PREFIX; | 1562 | lflags |= LOG_PREFIX; |
1563 | } | 1563 | } |
1564 | /* | ||
1565 | * No need to check length here because vscnprintf | ||
1566 | * put '\0' at the end of the string. Only valid and | ||
1567 | * newly printed level is detected. | ||
1568 | */ | ||
1564 | text_len -= end_of_header - text; | 1569 | text_len -= end_of_header - text; |
1565 | text = (char *)end_of_header; | 1570 | text = (char *)end_of_header; |
1566 | } | 1571 | } |