Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3526313ybt; Tue, 30 Jun 2020 05:13:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXV9SfBiOWHNk2uQJp7JlFWwdJKUf3/f/rQtPtAHfy45wEAJ7+WjZh2JlgNXInrMYuo7EA X-Received: by 2002:a05:6402:94f:: with SMTP id h15mr22977890edz.313.1593519200166; Tue, 30 Jun 2020 05:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593519200; cv=none; d=google.com; s=arc-20160816; b=0mvkr6T2upPlhjHC3Oh2oxWNmc5Bu1/uXQ3Cy10FfXB9ZSrdpSMXoRs5XGNpkACh9Y 9KevBAPhImAebQn03/CcjNCisxEsBDgSZdI189Kvwg0cIzNWMqpFQt1v9hklR9uyL8To 0Yq7B11MKJkR3WpRSW8Luo/NRA1mX2VFFuCzSc6/UIdqvBTY0PUlfqzxRb3ePhYi6rUy lBmx5n/QRS0X8urKEOr6BXveKF6kPJQ/5tHXLO5+lkoQpnX3AUT/yOWCozyMqJzIzt6E Omv5DEJcNVCNiKKsgdc/UBvNzjbrF+iJ4LsFD8QWhb7J3vja3+QhA+GfuHRLfz7aExLr W/kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=xYEhR3NPE0R7pZWBg0esf/zJ5br2kx+ti6+DuUnJYI8=; b=0mxeQZDAaY88Wc8hzOqznlVivvh6KbDjVA0W8DbpSL22opg2dRIcWzMqP3o6r2J+LA 6DkHSiKJslCu3G/8ekzWbmp9aC+G3SvGGC/CzI0n+siUfyHzi4uKdP5xUGjszth1cHil EZU5pqfsk7GdYX8dsELylJB73cvKD8dRXjuUjfaYuuFexeeETtgxtmcqPMbpLReGOaOG SlF+ZCSP4kpWGNqBbpQGcU9a/mVY/lUxF9UrmT068AEvlhOM7LctMGMBoFKQNOhfjXqK 6QgHvxHRXiK0O4nkWvztD6rMeY4vzqaSWyWNGksshM6H1nOrwKp03b7SxMXqjhbY8owZ o6pw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du14si1844779ejc.721.2020.06.30.05.12.56; Tue, 30 Jun 2020 05:13:20 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732160AbgF3Lsz (ORCPT + 99 others); Tue, 30 Jun 2020 07:48:55 -0400 Received: from mga11.intel.com ([192.55.52.93]:38196 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728419AbgF3Lsz (ORCPT ); Tue, 30 Jun 2020 07:48:55 -0400 IronPort-SDR: g68+hleK2PBihtnis3D2iThpaLCWSXzz2pPSTs37mN1vKvAinIucUHE2cgsQRHbVwPbLpoGYb4 sqQoQKNpdPBw== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="144393104" X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="144393104" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2020 04:48:54 -0700 IronPort-SDR: ihgcD26HSd3er82WHpBPNsTmfMXWuX0VTAgCQbXncFKlSOgMMooZOmtHqZSTtOqA03umGNVwON cM8cyw3LULCw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,297,1589266800"; d="scan'208";a="386674833" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga001.fm.intel.com with ESMTP; 30 Jun 2020 04:48:52 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1jqEkv-00Gpqe-Gf; Tue, 30 Jun 2020 14:48:53 +0300 Date: Tue, 30 Jun 2020 14:48:53 +0300 From: Andy Shevchenko To: Sumit Garg Cc: Cengiz Can , Daniel Thompson , Douglas Anderson , Jason Wessel , kgdb-bugreport@lists.sourceforge.net, Linux Kernel Mailing List , Petr Mladek Subject: Re: [PATCH v3] kdb: remove unnecessary null check of dbg_io_ops Message-ID: <20200630114853.GS3703480@smile.fi.intel.com> References: <20200630082922.28672-1-cengiz@kernel.wtf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 30, 2020 at 05:06:31PM +0530, Sumit Garg wrote: > On Tue, 30 Jun 2020 at 14:00, Cengiz Can wrote: > > > > `kdb_msg_write` operates on a global `struct kgdb_io *` called > > `dbg_io_ops`. > > > > It's initialized in `debug_core.c` and checked throughout the debug > > flow. > > > > There's a null check in `kdb_msg_write` which triggers static analyzers > > and gives the (almost entirely wrong) impression that it can be null. > > > > Coverity scanner caught this as CID 1465042. > > > > I have removed the unnecessary null check and eliminated false-positive > > forward null dereference warning. > > - while (len--) { > > - dbg_io_ops->write_char(*cp); > > - cp++; > > - } > > + while (len--) { > > + dbg_io_ops->write_char(*cp); > > + cp++; > > } Despite being in the original code this can be simple done in two lines: while (len--) dbg_io_ops->write_char(*cp++); -- With Best Regards, Andy Shevchenko