Received: by 10.223.185.116 with SMTP id b49csp8758961wrg; Fri, 2 Mar 2018 07:28:55 -0800 (PST) X-Google-Smtp-Source: AG47ELuynzQy8la1dbniInpQWTQDa0iFA2MqCU0xel8LUeN10/41Zoi6bgpW80AtSnBSrpRPP/U/ X-Received: by 10.101.66.196 with SMTP id l4mr4838730pgp.66.1520004535735; Fri, 02 Mar 2018 07:28:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520004535; cv=none; d=google.com; s=arc-20160816; b=bXpXH8beAdXHTp5xEntOXuxEMcc5KzH8K57/N6UfgV39vyt1scMftKFaSKmcqeAX50 GCYcUivQBYsPzTtggc5UQKkJtGB++A9He38tbHM/kkiF/q+cuDNmT5TYjHu6EFcMZZIN dcUEWCeYHPv9OE2C2DM/+Fkn/7uEQnrtqCzI04jBLRGVN48zvgmWO3FDnNJ65sCdaal0 xA3FCzawRxUJjKXrOMkVQF6GjgJtyyi3F8nIjlbqyDeAMg6LLjbo3RKF7Nw5T9boRoSJ Atwycdwf4GONLFnA28UT+okoUC4ZC1wm28hb9IvU8io1X4SANKs40iFEgiBZqgG3dxv6 IMEQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=gd3V/xEU2CxYw7V5djkIGzPcZN/gsneVLQIaKUrBTkc=; b=ubJk8FruAs41Mlql7kWz/4bT2PLV9z25jR4G9O6QxqzpSb9D0asnRXfhn1stHltelv qK7SXGpDOu0nTuv9BD0+BxFnTMoCiMPo0p2PSOVjJ6dgsqYyCELxJEh0qWYKy/crp0Lv g4XQIV+x3RHrXnPawvoDyvhRW4nNbneJUFKG4NXbaS/u+i7tvrNSpCdlFnTJfs/gmoQL EGA12RXNC7F+mQG9Mtd476q82btxV5pVLRI7IdnI4h+Lq0KMW3/FzZRP3V08DePtsgE+ bmyPt8MDc/dPU8DWMoHwcpk624HXPEaXJ7UAHgKcP+NwAMvkA/dMjWMS7gkkE7PjyYiY 3HGg== 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 i63si5028994pfj.365.2018.03.02.07.28.40; Fri, 02 Mar 2018 07:28:55 -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 S1427858AbeCBMvY (ORCPT + 99 others); Fri, 2 Mar 2018 07:51:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:49678 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424020AbeCBMvU (ORCPT ); Fri, 2 Mar 2018 07:51:20 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 73DA7B4BA; Fri, 2 Mar 2018 12:51:19 +0000 (UTC) Date: Fri, 2 Mar 2018 13:51:18 +0100 From: Petr Mladek To: Andy Shevchenko Cc: "Tobin C . Harding" , linux@rasmusvillemoes.dk, Joe Perches , linux-kernel@vger.kernel.org, Andrew Morton , Michal Hocko Subject: Re: [PATCH v2 8/9] lib/vsprintf: Remove useless NULL checks Message-ID: <20180302125118.bjd3tbuu72vgfczo@pathway.suse.cz> References: <20180216210711.79901-1-andriy.shevchenko@linux.intel.com> <20180216210711.79901-8-andriy.shevchenko@linux.intel.com> <20180227155047.o74ohmoyj56up6pa@pathway.suse.cz> <1519752950.10722.231.camel@linux.intel.com> <20180228100437.o4juwxbzomkqjvjx@pathway.suse.cz> <1519814544.10722.266.camel@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519814544.10722.266.camel@linux.intel.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2018-02-28 12:42:24, Andy Shevchenko wrote: > On Wed, 2018-02-28 at 11:04 +0100, Petr Mladek wrote: > > On Tue 2018-02-27 19:35:50, Andy Shevchenko wrote: > > > On Tue, 2018-02-27 at 16:50 +0100, Petr Mladek wrote: > > Note that it will most likely crash in vprintk_emit() on the line > > > > text_len = vscnprintf(text, sizeof(textbuf), fmt, args); > > > > It will be with logbug_lock() taken. The nested printk() messages > > will be stored in per-CPU buffer thanks to printk_safe code. > > Yeah, that's bad. > > > IMHO, it would make sense to hanve this check also pointers that are > > being deferred. > > Send a patch to discuss! I thought about this more. IMHO, the check for PAGE_SIZE in pointer() makes perfect sense. It helps to avoid crash and actually see the message. I am going to send the patch in a minute. BTW: I am not sure who is going to pass this patchset to Linus. If nobody is against, I could eventually do so via printk.git. > > > > To be honest, I do not feel experienced enough to decide > > > > about the preferred behavior. On one hand, it is bad when > > > > printk() would crash the kernel. On the other hand, hiding wide > > > > range of values under "(null)" string might confuse people. > > > > Would it make sense to survive and write different strings for > > > > difference intervals? For example? > > > > > > > > "(null)" for ptr == 0 > > > > "(null-16)" for ptr > 0 && ptr <= 16 > > > > "(null-pg)" for prt > 16 && ptr <= PAGE_SIZE > > > > > > > > In each case, this patch changes the behavior and it should > > > > be documented in the commit message. > > > > > > Personally I strongly disagree with blowing code up in such places > > > for little or none benefit. > > Send a patch to discuss! I am not going to do so unless there is an evidence that people are confused or that the above idea is desired. Best Regards, Petr