Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936205AbdGTKW4 (ORCPT ); Thu, 20 Jul 2017 06:22:56 -0400 Received: from mga02.intel.com ([134.134.136.20]:47282 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934938AbdGTKWh (ORCPT ); Thu, 20 Jul 2017 06:22:37 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,383,1496127600"; d="scan'208";a="289227335" Message-ID: <1500546142.29303.133.camel@linux.intel.com> Subject: Re: [PATCH v1 01/25] lib/vsprintf: Remove useless NULL checks From: Andy Shevchenko To: Rasmus Villemoes Cc: Rasmus Villemoes , Greg Kroah-Hartman , Andrew Morton , linux-kernel@vger.kernel.org, Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org Date: Thu, 20 Jul 2017 13:22:22 +0300 In-Reply-To: <87shjakxg1.fsf@rasmusvillemoes.dk> References: <20170608134811.60786-1-andriy.shevchenko@linux.intel.com> <20170608134811.60786-2-andriy.shevchenko@linux.intel.com> <87shjakxg1.fsf@rasmusvillemoes.dk> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1018 Lines: 34 On Thu, 2017-06-08 at 22:59 +0200, Rasmus Villemoes wrote: > On Thu, Jun 08 2017, Andy Shevchenko m> wrote: > > The pointer can't be NULL since it's first what has been done in the > > pointer().   > > - if (ZERO_OR_NULL_PTR(addr)) > > - return string(buf, end, NULL, spec); /* NULL > > pointer */ > > - > > - > > Well, ZERO_OR_NULL_PTR checks for a little more than !addr, but I > suppose that if anyone passes the result from kmalloc(0) to %ph, > they'd > better also pass 0 as the size, so the .field_width tests should be > sufficient. If we care about kmalloc(0) check we better to do this in pointer()? > > - if (!IS_ENABLED(CONFIG_HAVE_CLK) || !clk) > > - return string(buf, end, NULL, spec); > > - > > Well, it may be safe, but removing the IS_ENABLED(CONFIG_HAVE_CLK) > check > means that clock() becomes a much bigger function when > !IS_ENABLED(CONFIG_HAVE_CLK). I return back this in v2. -- Andy Shevchenko Intel Finland Oy