Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3094765ybt; Mon, 29 Jun 2020 15:13:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ0IrEeOZwt+KxuyBzCFTXBKGIxS4xOncTXQ4F5SJqYHdh6RnubIPSjbGJvyyD9dhCXTHM X-Received: by 2002:a17:906:c002:: with SMTP id e2mr10536409ejz.244.1593468793170; Mon, 29 Jun 2020 15:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593468793; cv=none; d=google.com; s=arc-20160816; b=UKsndlJUydlKpVCuMpfuQuHk6eH+/huJ6M1nxCyWR+KkcKkH9qlnVdwGmqXjUIXO6M IJa498/cWp33YaNc+iw/ISAfdNv1b6wbzEcE3af83PV6IKPO4cUwGew8HSgBo5FJdNmm XQJe4/6Xcnbc0CubPISPfbVOaPMOAuKrMJR1NeGf9yKoPtmJhDsVEpXvylsj2CW9vuaX 9iRZiqEu4IV2LAV6ariLEGYbrRgNOzCAse1K7EkMc0CeFqBQPR8yDGeUOS4EfvJLey73 EzxZ6BO8EFa4e3kiPD3ajuPCk+IujFN/1NU90Tb/RTNe4Jl8dVFxuHmCESEvapMOibuH hmJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :subject:user-agent:references:in-reply-to:message-id:date:cc:to :from; bh=lVLc3zonLFO9f5Fm8kzfIUI4UYbR8WgB+WNIp0DSlqA=; b=Kl0QnDcoRYyLMhgj/kYYEvrlLagKbJ6puh9SYMNQT+2yjJA3vRz/e+Xgy3CpMNxR5Y WlrneTQhF+EF6Xk7/4rjB1CrQ7br1yWQIrzyWjUetSdFypzHFvTaBB/xwXZLbt/b9nfr Mo/UL6/LnW3W1Cb5yJTSl86idISN4bIApAghwY5w1m4fJk18RA3om0MuqmzTNhgDJccu 9iBx6y5buvJCwLx2PwjlhDrx/LD/jH9MRCQqIBxbUTXXh8f8IYmSC5CSxoi3pYqFIjhF XmXSFIgMZxncV4B3Hs89++5HYx3R/j9ezx2kkX7rZ6w99FxXLOnWCqKH7+1cBrmJj7Hf OdMw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si520425ejb.510.2020.06.29.15.12.49; Mon, 29 Jun 2020 15:13:13 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726199AbgF2WKZ (ORCPT + 99 others); Mon, 29 Jun 2020 18:10:25 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:56811 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbgF2WKZ (ORCPT ); Mon, 29 Jun 2020 18:10:25 -0400 X-Originating-IP: 176.88.144.104 Received: from [192.168.1.4] (unknown [176.88.144.104]) (Authenticated sender: cengiz@kernel.wtf) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 29A3A20007; Mon, 29 Jun 2020 22:10:20 +0000 (UTC) From: Cengiz Can To: Doug Anderson CC: Daniel Thompson , Andy Shevchenko , Jason Wessel , , LKML , Petr Mladek , Sumit Garg Date: Tue, 30 Jun 2020 01:10:19 +0300 Message-ID: <173022188f8.2bfa.85c738e3968116fc5c0dc2de74002084@kernel.wtf> In-Reply-To: References: <20200629153756.cxg74nec3repa4lu@holly.lan> <20200629205012.3263-1-cengiz@kernel.wtf> User-Agent: AquaMail/1.25.0-1628 (build: 102500003) Subject: Re: [PATCH v2] kdb: remove unnecessary null check of dbg_io_ops MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="us-ascii" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On June 30, 2020 00:16:54 Doug Anderson wrote: > 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] Oops! Sorry for that.. I admit I didn't compile check my second attempt. /me ducks and covers Will fix it asap. Thanks! > > -Doug