Received: by 10.223.176.5 with SMTP id f5csp2635437wra; Mon, 5 Feb 2018 07:23:40 -0800 (PST) X-Google-Smtp-Source: AH8x226pUmprljh9wwppwtgh7kKAtAFWX838HyoJrfd3hYWp4quRzAfqud6Argl6EKQQW0FrY4dy X-Received: by 10.99.120.8 with SMTP id t8mr29599291pgc.371.1517844220028; Mon, 05 Feb 2018 07:23:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517844219; cv=none; d=google.com; s=arc-20160816; b=mlYPtpeCLlaCANysjbTB9IMWsXH4nLskO1/s3MMv0xpMEGiQBkl7XIDWiQBddW2UbD CdHYASOi7OIavTFKpg00DhEatbnbvYvGcutziKJQIL8FqkSXyVzjUOnHWyQ8jIEWEuDj 1OW5WgUHeNx17Z0632L+c0yl7zghCrhELtAAtupxTJLZD+6DrzwAyBeB9Va6QtkAgjAb lDP3Anzo/sR3D2in03ttkuE/mFrSwn6llTPulLom+4gjvWDdn0D8dHFGmigaLFKhxbXB fIFP4by6/QOSmQXvC6Y7CVl7EuB32H9dludSRubpghIoCys8s0gOc0tOI7Mf1efpIYhQ iJ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=PVtscbstNKZPQh6ske5HNmZeZqZeUMPTMO3KsGPt0jA=; b=yaNff9G1jrOxgyGTk7mEHCAYPtnaviOlvcsLmjxIpvgkilSremcjxLbqN3lpWKbjue QNWrx0z7ZcBSYFE5Iu3M5ESmw7ZYxNt/b9PHSr1TTFJRMg6F+Qr855YELvqnTwJqiefb 5jLq1QaTV/P8HD2+UL8sXYW3rFgb68x0TK/tvl74XSgij4lz/EPGv95PnGz/W8Z7deQl pM31EGPw/IQyhL5u4SCqzdXc4fIwm1IaNdwWz4VqlignJ/XMgqqcbXPid3G3ZTABviJ4 rvml5S0suJ9ZrhjdyliJe4XLjkTM2aL44+Tt9IdGL3O4gyRf7Ly3NyAhqGFKxaLUDnF3 bR+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h80si7019804pfj.207.2018.02.05.07.23.25; Mon, 05 Feb 2018 07:23:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753126AbeBEPWp (ORCPT + 99 others); Mon, 5 Feb 2018 10:22:45 -0500 Received: from tartarus.angband.pl ([89.206.35.136]:48874 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752925AbeBEPWk (ORCPT ); Mon, 5 Feb 2018 10:22:40 -0500 Received: from kilobyte by tartarus.angband.pl with local (Exim 4.89) (envelope-from ) id 1eiib5-0005pM-2v; Mon, 05 Feb 2018 16:22:19 +0100 Date: Mon, 5 Feb 2018 16:22:19 +0100 From: Adam Borowski To: "Tobin C. Harding" Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , linux-kernel@vger.kernel.org, Andrew Morton , Joe Perches , Kees Cook , "Roberts, William C" , Linus Torvalds , David Laight , Randy Dunlap , Geert Uytterhoeven Subject: Re: [PATCH] vsprintf: avoid misleading "(null)" for %px Message-ID: <20180205152218.hxgozi67zka4hgkf@angband.pl> References: <20180204174521.21383-1-kilobyte@angband.pl> <20180205094438.pfd7ffymlvklpxe7@pathway.suse.cz> <20180205100305.GO29988@eros> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180205100305.GO29988@eros> X-Junkbait: aaron@angband.pl, zzyx@angband.pl User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kilobyte@angband.pl X-SA-Exim-Scanned: No (on tartarus.angband.pl); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 05, 2018 at 09:03:05PM +1100, Tobin C. Harding wrote: > On Mon, Feb 05, 2018 at 10:44:38AM +0100, Petr Mladek wrote: > > On Sun 2018-02-04 18:45:21, Adam Borowski wrote: > > > Like %pK already does, print "00000000" instead. > > > > > > This confused people -- the convention is that "(null)" means you tried to > > > dereference a null pointer as opposed to printing the address. > > > > By other words, this avoids regressions when people convert > > %x to %px. Do I get it right, please? It's a regression in the sense that it confuses people. %px never could dereference a pointer so the information provided doesn't change, merely its presentation. > > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > > > index 77ee6ced11b1..d7a708f82559 100644 > > > --- a/lib/vsprintf.c > > > +++ b/lib/vsprintf.c > > > @@ -1849,7 +1849,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, > > > { > > > const int default_width = 2 * sizeof(void *); > > > > > > - if (!ptr && *fmt != 'K') { > > > + if (!ptr && *fmt != 'K' && *fmt != 'x') { > > I don't know if it matters but with this it won't be immediately > apparent that a null pointer was printed (since zero could hash to > anything). My change touches %px only, where your concern doesn't apply. You're right, though, when it comes to %pK: printk("%%pK: %pK, %%px: %px\n", 0, 0); says %pK: 00000000ba8bdc0a, %px: 0000000000000000 So what should we do? Avoid hashing 0? Print a special value? Meow! -- ⢀⣴⠾⠻⢶⣦⠀ The bill with 3 years prison for mentioning Polish concentration ⣾⠁⢰⠒⠀⣿⡁ camps is back. What about KL Warschau (operating until 1956)? ⢿⡄⠘⠷⠚⠋⠀ Zgoda? Łambinowice? Most ex-German KLs? If those were "soviet ⠈⠳⣄⠀⠀⠀⠀ puppets", Bereza Kartuska? Sikorski's camps in UK (thanks Brits!)?