Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3064743ybt; Mon, 29 Jun 2020 14:20:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDIHiFrUJngBlD2PDLSEaNUyIt9qyjD2FAo4S256GrhtW2UiOkgHjztV0KrktgfVdyeNVI X-Received: by 2002:a17:906:a058:: with SMTP id bg24mr15713466ejb.370.1593465640871; Mon, 29 Jun 2020 14:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593465640; cv=none; d=google.com; s=arc-20160816; b=F93T3Huws4Gm5xuxGdi3OGdaGzVZyeUZsB3JEZOXuaufL/TNq5D2QUiH+jS6zoSnFx 4JDaSajiOgKg8+YaZksPVHEkNaDCFKFvHcW2bnmwmbVn/+fWR8Va2/0WpkncagJLTKJO uVfPCmuqwY1IHCEK9Hgoy0F1HvdZDabL+0WsqxiIm2OHsbsjDs+7FyStUA2281CEBd2O IkS7v1KYqjrxreRbmJun6Zsa1DrIHtzuNW/ymEwYJEQ++ilxeayE4m0t8ekTMS+H0QGW bcx6um+Pi36fS77WgZJs3sB57qUvvy095ObdkE14rcxB5S/pEoQMhiXhMyRv84/GgkSp wnYA== 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:dkim-signature; bh=Glv9KPcU1i2kTi/iXapQFW9l12MhBnrThVYjifxz8EM=; b=Kw+dbVEEl37azPt8kFi4ZKnAXkG2xoikbkHKvwtar+TqoKmcBLZl2Ja1Kv9agpZWdW CM2M+9VPZ5vXMBnnyUv5i0WS2vp1C1Yjkk9VSDe4MZZtgwnOx3+9+z0MA6JFs81g2te4 SHLwJM8V5gJQzycNjCprJart4MksVl7hw/F2EIABDyX88IuSv5ybijlLiUcOzPbOEh0T sQex4IHMe8/54SYjLCnOS+PRmkzw++sQgqTII9H+Fbey/wX6B49jv09uqSxStWVcp7aC HSNZhVCiqT4NaqI5dwLLUmSIf5UuMWsAG7dtxa5nami1O8VlYnCABmvotVmH8PWk8jBD xkgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iQSpfw6T; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u18si353664edx.489.2020.06.29.14.20.17; Mon, 29 Jun 2020 14:20:40 -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; dkim=pass header.i=@chromium.org header.s=google header.b=iQSpfw6T; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390728AbgF2VQz (ORCPT + 99 others); Mon, 29 Jun 2020 17:16:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729803AbgF2VQy (ORCPT ); Mon, 29 Jun 2020 17:16:54 -0400 Received: from mail-ua1-x941.google.com (mail-ua1-x941.google.com [IPv6:2607:f8b0:4864:20::941]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55F42C061755 for ; Mon, 29 Jun 2020 14:16:53 -0700 (PDT) Received: by mail-ua1-x941.google.com with SMTP id e3so5806466uan.2 for ; Mon, 29 Jun 2020 14:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Glv9KPcU1i2kTi/iXapQFW9l12MhBnrThVYjifxz8EM=; b=iQSpfw6Tm/KPuTk+bUTfK5sUy4UnMTGDe2HrdR0LJ5iy/NBxQZbLKaAMr5P8IsFaKS jlx65KlHQsr6onY+QHMDKYDN0o/+INkFidVgT0E/5uY2DgBuPiWIVZPfHlo/wnPJUZ6E 9jTXUZ6lxK0iNtd4wO6o08CCwbn+1DdmLYhvg= 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=Glv9KPcU1i2kTi/iXapQFW9l12MhBnrThVYjifxz8EM=; b=eZSOLjfLCLNTPgakZUZGP6Gs13hcaSC7hRC3n8cQPip+HqeoKu+MfJqT7/0kv0dj0C jI1nbb8zwJw7PH57wIEFGz+1UFcnyJq1s9yLP4i4l/djl4ymVVnlECQB2tE/NTEQb8cH S9LBOv7ZWT0AkXKqrIpuxwuH59eAkmnAybY3ou1ynUZ2B1dSap8Khd4widhw6K7ABF30 D0DMuxbS3NsHTQJRZMU6GBmm3avhix7nzou2K1HSrqEj7lLSlg+C1LVNdNmSwkeCi5xs A2G+WNwz3HwYwXbWJoeRX6bI4QbLmjFw6Z0Ca3qQGkdIAMpGKfZAolYxnPUOvUba93+u Si2w== X-Gm-Message-State: AOAM533X/WRAfqBH15rnEms2H6CVkMt6dwc6uknh8w+a+8rjOZOccmCD 1nHBHEjiHqIb4JfAQYV69qTxd/0o3UE= X-Received: by 2002:ab0:3055:: with SMTP id x21mr12245784ual.106.1593465412330; Mon, 29 Jun 2020 14:16:52 -0700 (PDT) Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com. [209.85.222.46]) by smtp.gmail.com with ESMTPSA id b9sm89814vsp.24.2020.06.29.14.16.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Jun 2020 14:16:51 -0700 (PDT) Received: by mail-ua1-f46.google.com with SMTP id q15so5595845uap.4 for ; Mon, 29 Jun 2020 14:16:51 -0700 (PDT) X-Received: by 2002:ab0:29c1:: with SMTP id i1mr12275723uaq.120.1593465411383; Mon, 29 Jun 2020 14:16:51 -0700 (PDT) MIME-Version: 1.0 References: <20200629153756.cxg74nec3repa4lu@holly.lan> <20200629205012.3263-1-cengiz@kernel.wtf> In-Reply-To: <20200629205012.3263-1-cengiz@kernel.wtf> From: Doug Anderson Date: Mon, 29 Jun 2020 14:16:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] kdb: remove unnecessary null check of dbg_io_ops To: Cengiz Can Cc: Daniel Thompson , Andy Shevchenko , Jason Wessel , kgdb-bugreport@lists.sourceforge.net, LKML , Petr Mladek , Sumit Garg 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, On Mon, Jun 29, 2020 at 1:50 PM 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. > > Signed-off-by: Cengiz Can > --- > kernel/debug/kdb/kdb_io.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c > index 683a799618ad..4ac59a4fbeec 100644 > --- a/kernel/debug/kdb/kdb_io.c > +++ b/kernel/debug/kdb/kdb_io.c > @@ -549,14 +549,12 @@ static void kdb_msg_write(const char *msg, int msg_len) > if (msg_len == 0) > return; > > - if (dbg_io_ops) { > - const char *cp = msg; > - int len = msg_len; > + const char *cp = msg; > + int len = msg_len; kernel/debug/kdb/kdb_io.c:552:14: warning: ISO C90 forbids mixing declarations and code [-Wdeclaration-after-statement] -Doug