Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6713244yba; Tue, 14 May 2019 12:14:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJCNiBMvd5SA9LBa+HatZo9xW9uy7xaiuoih+luXnqVDF4Vz1TkQee6Vypkgv5Sierx5E1 X-Received: by 2002:a63:fd4a:: with SMTP id m10mr40355644pgj.302.1557861295711; Tue, 14 May 2019 12:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557861295; cv=none; d=google.com; s=arc-20160816; b=jOkIaJyiueHHn62T8E7ytzihxR0qNGXIKpEOwoMyxoO3yJkWILnxCFHrRATIAZ7PIr 6vvW5l4uVw/zVkxdbmqGO5F3oub9wGItjAnDTcGbQ/gJo4/RjNNHnS+YUIJY2MsG7cHy Ggo6zhFetM1XQbfdAMO5+58LTKYDyanaAqUFAPpU6Rgg+Ho+UHwtp7HHeipL9i+Vf2+o EIzO+SpzOyxvI5aopZLiDkFutjdnleyROxRh6eTqDuULH5XM1j6oUj1kVHvzmTpwlDRy pcDpyDbrNuEyjNWsuLP3Urd4hno482GGqciNkls91++caJySZi/iifVTfwPUs5GeMC9p KGGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ey484zS6VT0M2Pei8ezvWLc9zrbpgGtkTWzKMtIHIxc=; b=ciXXi2Yqy4khJj4sa1wEHFuTQ9X7nkXxeEpB+QNP9COpcFSo5RzYPoSP0cIuawk4v9 Ch/EsI/PX1BcFhrCDmTVYsvVEncfnioQJVQ/Grp13nA2/UDZDrfJS0C4c3ZP4z54DVk1 UNEOxXtuJlxpzeFWEfOTwcXhNKm/5D/cZOhsmPdqsSHSxaup+zXaFguqTC6OZOQ7RySZ iu+yymWMuWdmGemoCMJqX361YZ/9BrExlxFKPoxOZg8RLYrL+reLh9FErJsLL2ESrvPn Hm1jIBEaINNPIBm3Z5gVxRcH4s5W4oc0nd0b5GroNziE27nOdqotq2ntnmY7GMh3/rz+ 7dNw== 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 h186si19461553pge.184.2019.05.14.12.14.41; Tue, 14 May 2019 12:14:55 -0700 (PDT) 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 S1726393AbfENTNV (ORCPT + 99 others); Tue, 14 May 2019 15:13:21 -0400 Received: from mail-ua1-f67.google.com ([209.85.222.67]:43484 "EHLO mail-ua1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfENTNU (ORCPT ); Tue, 14 May 2019 15:13:20 -0400 Received: by mail-ua1-f67.google.com with SMTP id u4so52483uau.10; Tue, 14 May 2019 12:13:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ey484zS6VT0M2Pei8ezvWLc9zrbpgGtkTWzKMtIHIxc=; b=bTyAxoi26MlY32ZVEWBpc7IGzT3MRipSSpeh1dW8sAyxHhYv+tEULUybeSBsS4y/rM K17+FAipOKt/JQ1OXodXFnyllxPBO7RtMH4zGIo6XCCVl/j1fkvWbGy9qZ3GAwVv5cQf Zc5XtBM2cpl+Gy3kVLjg4dfZQTfnN239oUNoibgiiYA7wqk+7sftZASUEGORTP4139T0 HIKVszzo+dnB88opp4BHRfXK/z2WUyiixur1sXN6dx9U/etbpf7my5/Sy6zTuydB9rhv ImSZW2Nuc4sp8lVGGgUxK3mBDA90p/715SAUo3ipUOy5Mi5fugNtzMqTSRA+l4Uw78pT MTKQ== X-Gm-Message-State: APjAAAUCwomsx5kb6zpFxhA/4NXhWcELobCNCUfBlcPmrvBx4aviesbC 9/ls5TKnsrTWAVqlX90ZEjCFw1Fb7Ehwz3Tmaak= X-Received: by 2002:ab0:d89:: with SMTP id i9mr17498845uak.96.1557861198950; Tue, 14 May 2019 12:13:18 -0700 (PDT) MIME-Version: 1.0 References: <20190510081635.GA4533@jagdpanzerIV> <20190510084213.22149-1-pmladek@suse.com> <20190510122401.21a598f6@gandalf.local.home> <096d6c9c17b3484484d9d9d3f3aa3a7c@AcuMS.aculab.com> <20190513091320.GK9224@smile.fi.intel.com> <20190513124220.wty2qbnz4wo52h3x@pathway.suse.cz> <20190514020730.GA651@jagdpanzerIV> <45348cf615fe40d383c1a25688d4a88f@AcuMS.aculab.com> <20190514143751.48e81e05@oasis.local.home> In-Reply-To: <20190514143751.48e81e05@oasis.local.home> From: Geert Uytterhoeven Date: Tue, 14 May 2019 21:13:06 +0200 Message-ID: Subject: Re: [PATCH] vsprintf: Do not break early boot with probing addresses To: Steven Rostedt Cc: David Laight , Sergey Senozhatsky , Petr Mladek , Andy Shevchenko , christophe leroy , Linus Torvalds , Rasmus Villemoes , "Tobin C . Harding" , Michal Hocko , Sergey Senozhatsky , "linux-kernel@vger.kernel.org" , Michael Ellerman , "linuxppc-dev@lists.ozlabs.org" , Russell Currey , Stephen Rothwell , Heiko Carstens , "linux-arch@vger.kernel.org" , "linux-s390@vger.kernel.org" , Martin Schwidefsky Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steve, On Tue, May 14, 2019 at 8:37 PM Steven Rostedt wrote: > On Tue, 14 May 2019 11:02:17 +0200 > Geert Uytterhoeven wrote: > > On Tue, May 14, 2019 at 10:29 AM David Laight wrote: > > > > And I like Steven's "(fault)" idea. > > > > How about this: > > > > > > > > if ptr < PAGE_SIZE -> "(null)" > > > > if IS_ERR_VALUE(ptr) -> "(fault)" > > > > > > > > -ss > > > > > > Or: > > > if (ptr < PAGE_SIZE) > > > return ptr ? "(null+)" : "(null)"; > > Hmm, that is useful. > > > > if IS_ERR_VALUE(ptr) > > > return "(errno)" > > I still prefer "(fault)" as is pretty much all I would expect from a > pointer dereference, even if it is just bad parsing of, say, a parsing > an MAC address. "fault" is generic enough. "errno" will be confusing, > because that's normally a variable not a output. > > > > > Do we care about the value? "(-E%u)"? > > That too could be confusing. What would (-E22) be considered by a user > doing an sprintf() on some string. I know that would confuse me, or I > would think that it was what the %pX displayed, and wonder why it > displayed it that way. Whereas "(fault)" is quite obvious for any %p > use case. I would immediately understand there's a missing IS_ERR() check in a function that can return -EINVAL, without having to add a new printk() to find out what kind of bogus value has been received, and without having to reboot, and trying to reproduce... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds