Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752015AbbEJTma (ORCPT ); Sun, 10 May 2015 15:42:30 -0400 Received: from mail.sigma-star.at ([95.130.255.111]:14386 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751720AbbEJTm0 (ORCPT ); Sun, 10 May 2015 15:42:26 -0400 From: Richard Weinberger To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Richard Weinberger Subject: [PATCH 1/2] Fix printk() on ERR_PTR() Date: Sun, 10 May 2015 21:42:15 +0200 Message-Id: <1431286936-4333-2-git-send-email-richard@nod.at> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1431286936-4333-1-git-send-email-richard@nod.at> References: <1431286936-4333-1-git-send-email-richard@nod.at> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1055 Lines: 34 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/