From: Richard Weinberger <richard@nod.at>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Richard Weinberger <richard@nod.at>
Subject: [PATCH 1/2] Fix printk() on ERR_PTR()
Date: Sun, 10 May 2015 21:42:15 +0200 [thread overview]
Message-ID: <1431286936-4333-2-git-send-email-richard@nod.at> (raw)
In-Reply-To: <1431286936-4333-1-git-send-email-richard@nod.at>
vbin_printf() checks whether the provided pointer is larger
than -PAGE_SIZE such that it does not explode on ERR_PTR() pointers.
printk() does not.
Let's add this check also to the printk() code such that
trace_printk() and printk() are consistent again.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
lib/vsprintf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index da39c60..092d5a7 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -511,7 +511,8 @@ char *string(char *buf, char *end, const char *s, struct printf_spec spec)
{
int len, i;
- if ((unsigned long)s < PAGE_SIZE)
+ if ((unsigned long)s > (unsigned long)-PAGE_SIZE ||
+ (unsigned long)s < PAGE_SIZE)
s = "(null)";
len = strnlen(s, spec.precision);
--
1.8.4.5
next prev parent reply other threads:[~2015-05-10 19:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-10 19:42 vsprintf: Add support for userspace strings Richard Weinberger
2015-05-10 19:42 ` Richard Weinberger [this message]
2015-05-11 23:20 ` [PATCH 1/2] Fix printk() on ERR_PTR() Andrew Morton
2015-05-12 7:23 ` Richard Weinberger
2015-05-10 19:42 ` [PATCH 2/2] vsprintf: Add support for userspace strings Richard Weinberger
2015-05-10 20:09 ` Joe Perches
2015-05-10 20:11 ` Richard Weinberger
2015-05-10 20:16 ` Joe Perches
2015-05-10 20:22 ` Richard Weinberger
2015-05-11 23:23 ` Andrew Morton
2015-05-12 7:31 ` Richard Weinberger
2015-05-11 0:24 ` Masami Hiramatsu
2015-05-11 8:59 ` Richard Weinberger
2015-05-11 10:57 ` Richard Weinberger
2015-05-11 20:42 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431286936-4333-2-git-send-email-richard@nod.at \
--to=richard@nod.at \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®