Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7313447pxb; Thu, 18 Feb 2021 07:02:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJw81dvfkEdFQfl0dbc4TfVQ8hQF5G6+9wsNwIkk5Zw1CfHuRWj6qY9qc9RFkL4q+/CbbnXF X-Received: by 2002:a05:600c:3589:: with SMTP id p9mr4016604wmq.18.1613660572602; Thu, 18 Feb 2021 07:02:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613660572; cv=none; d=google.com; s=arc-20160816; b=w5zKkFgFmlF1DMtkxZ/dTyh22Dx2IBPrHRlVgxb4Lft5iFh4vW6yX0aOYjVVr9aFU1 +mfk8VdTKJenubwHwzgiwYgHfRab+BddgfnuzrHGASlEVUcAr+TxFy65NgDgdQsDKL+Q eKS3aiHc+k9HElBTFjJLAr175UxprtVfPxkh9CO6IiHRq3mj6C6zTKhP62YNE4o44jWk TOaickx4Sa8siRpiYKEKvK/XSnGF2/Oh7cJhJmj5rKrCljoV+4MwX0K/U9n4Wn01Hm59 T93UHTG163ufaYKFW7oUF5ZnXrse+hkMMXMWMN6ye21Fhrxc41vRi6Q/r6Vz/HH3rtkb KvUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=v2M2f1didXi8qZbKbJNpKDVS3nQGtSjoYLz7GZ8G2oA=; b=T335Has95DJoPlxtsRsmFxim7oGekID1uzwOUk/cnpQ/zqy4orTiRHQZydhiSJsHVM FOCO2SBO4Q7ukSWfRiojVa0kprJnepEYWOnLCk+zLm2/BnzVzKlZLz/P8X8DT4exbmMw UjSx8w+94/6VvfxiKEERwdoyuxJNHv6b7XC+kYMpSkfnm2ZK/H5L9B3tO4rvYyAszSqR 8Ow26HfBC7vgI69nuHJeX6zjhAilHQPh01agY2xU+51t9bHl7aVC4uaGyG+ntOO2+IBA 5fQwV4fOPGL9sjcDLHi5Q+KDiSoQ3N9uIherirgCg1a0N+YAeH3G8mux7K4fRnbNTKjY QhWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ajJ7vi+V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j9si203792edr.342.2021.02.18.07.02.27; Thu, 18 Feb 2021 07:02:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ajJ7vi+V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231937AbhBRO6b (ORCPT + 99 others); Thu, 18 Feb 2021 09:58:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:36448 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbhBRMyZ (ORCPT ); Thu, 18 Feb 2021 07:54:25 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613652819; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=v2M2f1didXi8qZbKbJNpKDVS3nQGtSjoYLz7GZ8G2oA=; b=ajJ7vi+VZU89eb/Xc0CIb/zbZ8fbz4u0n5nZ1PPyXZB1MjEiPGbcoUjg4gO+pEQzZN5oxY iS9PjZxTlHUPjRgYAoph22HnxcE/HR5nPx62wTdId879+BdncP3cqBdQMzcuRtwfE/kF1G TG8YVslckFPZaRMtiH6w0yE1tk8Rlbw= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DEE34ACE5; Thu, 18 Feb 2021 12:53:38 +0000 (UTC) Date: Thu, 18 Feb 2021 13:53:38 +0100 From: Petr Mladek To: Andy Shevchenko Cc: "Enrico Weigelt, metux IT consult" , linux-kernel@vger.kernel.org, rostedt@goodmis.org, sergey.senozhatsky@gmail.com, linux@rasmusvillemoes.dk, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH] lib: vsprintf: check for NULL device_node name in device_node_string() Message-ID: References: <20210217121543.13010-1-info@metux.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2021-02-17 15:50:00, Andy Shevchenko wrote: > On Wed, Feb 17, 2021 at 01:15:43PM +0100, Enrico Weigelt, metux IT consult wrote: > > Under rare circumstances it may happen that a device node's name is NULL > > (most likely kernel bug in some other place). > > What circumstances? How can I reproduce this? More information, please! > > > In such situations anything > > but helpful, if the debug printout crashes, and nobody knows what actually > > happened here. > > > > Therefore protect it by an explicit NULL check and print out an extra > > warning. > > ... > > > + pr_warn("device_node without name. Kernel bug ?\n"); > > If it's not once, then it's possible to have log spammed with this, right? > > ... > > > + p = ""; > > We have different standard de facto for NULL pointers to be printed. Actually > if you wish, you may gather them under one definition (maybe somewhere under > printk) and export to everybody to use. Please, use if (check_pointer(&buf, end, p, spec)) return buf; It will print "(null)" instead of the name. It should be enough to inform the user this way. The extra pr_warn() does not help much to localize the problem anyway. And it is better to avoid recursion in this path. Best Regards, Petr