From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752116AbdJZCyS (ORCPT ); Wed, 25 Oct 2017 22:54:18 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:43489 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751943AbdJZCyN (ORCPT ); Wed, 25 Oct 2017 22:54:13 -0400 X-ME-Sender: From: "Tobin C. Harding" To: kernel-hardening@lists.openwall.com Cc: "Tobin C. Harding" , "Jason A. Donenfeld" , "Theodore Ts'o" , Linus Torvalds , Kees Cook , Paolo Bonzini , Tycho Andersen , "Roberts, William C" , Tejun Heo , Jordan Glover , Greg KH , Petr Mladek , Joe Perches , Ian Campbell , Sergey Senozhatsky , Catalin Marinas , Will Deacon , Steven Rostedt , Chris Fries , Dave Weinstein , Daniel Micay , Djalal Harouni , linux-kernel@vger.kernel.org Subject: [PATCH V8 1/2] printk: remove tabular output for NULL pointer Date: Thu, 26 Oct 2017 13:53:55 +1100 Message-Id: <1508986436-31966-2-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508986436-31966-1-git-send-email-me@tobin.cc> References: <1508986436-31966-1-git-send-email-me@tobin.cc> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently pointer() checks for a NULL pointer argument and then if so attempts to print "(null)" with _some_ standard width. This width cannot correctly be ascertained here because many of the printk specifiers print pointers of varying widths. Remove the attempt to print NULL pointers with a correct width. Signed-off-by: Tobin C. Harding --- lib/vsprintf.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 86c3385b9eb3..16a587aed40e 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1710,15 +1710,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, { const int default_width = 2 * sizeof(void *); - if (!ptr && *fmt != 'K') { - /* - * Print (null) with the same width as a pointer so it makes - * tabular output look nice. - */ - if (spec.field_width == -1) - spec.field_width = default_width; + if (!ptr && *fmt != 'K') return string(buf, end, "(null)", spec); - } switch (*fmt) { case 'F': -- 2.7.4