Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp461211ybl; Tue, 28 Jan 2020 06:20:06 -0800 (PST) X-Google-Smtp-Source: APXvYqy6IM5C/VlnGYaH9KchAuBUoHGYJyDg54bLzflnr8BlWiVhVb53JvhXlAAJcnqWEk9Nph3D X-Received: by 2002:a9d:68da:: with SMTP id i26mr8924137oto.65.1580221206754; Tue, 28 Jan 2020 06:20:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221206; cv=none; d=google.com; s=arc-20160816; b=tZvMrkTRCXOZicgUJBy4JNZcdkcvHviCQhdLssOdOLHdkcgBL7+gtdUgLE2clMARn2 GtP4+9ipB+Bg24Dz756sSc1pLOHwffe2+Hka7QzarYVI6gvgumbY7LnofGb0D6T/WX8N 6vS/kjQ+ntLJ01NGJWPB3ZCHTxhs4lbE0KFRfi4JH7PywnR9HcekSDfrMauIab8paGqu THbrGUZmWsUG9gYyblkDxeXg+ak1BuqVmrTab4pSz/qyfFy61k/aEOhKQLfh8ycKJUV2 3Md1gzgDauvPCOwTrBKCZnyM5WxEpto2nmvxiUwJiDdC9KTfw8EQIiN6pP+/wPB0ps/2 0Kgw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KRsbgH6S00L+ZnOhXwzIDiXNert8jirC3t4sImH1vxk=; b=kwzGEeflAY3iX/C9c82LZv2l1tWDrfVlmNWAHgqYWQtUJB29pajpSpititaAB13Y0r W4tulGyfZhwzzA8ZewZPAHHElzdZDJx8Txz+VYq/Hf4A+y5KhxcCu6sNfLLhQ2Kgg+Sj gzBvxPmzP9t7exunEXYXIngUrz/hhitzExfFd7Br4OGNcwT/M/O09bGc7suwTNaUnmAH 85kF2YX6+q2eAD6Jy+B7lOWC0jNBl/arYaQF4mwc2xa7p38ERiFyB8aEebevb7tt9jt0 UtdWOKxhVQhuUklx65n14o72ks0t4FU2TuQ8ocYqHRKPA9Xmgx6gi2cOG6KZWCu2+EXy 0mRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DvUEcIX+; 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 x68si5186325oia.227.2020.01.28.06.19.55; Tue, 28 Jan 2020 06:20:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b=DvUEcIX+; 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 S1730538AbgA1OTF (ORCPT + 99 others); Tue, 28 Jan 2020 09:19:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:43284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727119AbgA1OTC (ORCPT ); Tue, 28 Jan 2020 09:19:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5F4321739; Tue, 28 Jan 2020 14:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221142; bh=FVBRIvNLzZ2uud5CytgTjCtHQb2wDALFalCx3cUkgmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DvUEcIX+YFlwzK0mnrppRzpRZ4ODkK975xwQ0z7wlHhXwVHYpXapgCCDw4YShi26G kVu4ahqCeptM9NmzDwJGlF/IREDAuP8NtG163GvOWzxBIZ+IvmLIGq9/eaOUyYgJRH iow8mtrDdKczCtUuhWx0MYkzK2zW3TcjPTc32lBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Jon Maloy , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 104/271] tipc: tipc clang warning Date: Tue, 28 Jan 2020 15:04:13 +0100 Message-Id: <20200128135900.332205111@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jon Maloy [ Upstream commit 737889efe9713a0f20a75fd0de952841d9275e6b ] When checking the code with clang -Wsometimes-uninitialized we get the following warning: if (!tipc_link_is_establishing(l)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/tipc/node.c:847:46: note: uninitialized use occurs here tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr); net/tipc/node.c:831:2: note: remove the 'if' if its condition is always true if (!tipc_link_is_establishing(l)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/tipc/node.c:821:31: note: initialize the variable 'maddr' to silence this warning struct tipc_media_addr *maddr; We fix this by initializing 'maddr' to NULL. For the matter of clarity, we also test if 'xmitq' is non-empty before we use it and 'maddr' further down in the function. It will never happen that 'xmitq' is non- empty at the same time as 'maddr' is NULL, so this is a sufficient test. Fixes: 598411d70f85 ("tipc: make resetting of links non-atomic") Reported-by: Nathan Chancellor Signed-off-by: Jon Maloy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/tipc/node.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/tipc/node.c b/net/tipc/node.c index db8fbc076e1a5..fe7b0ad1d6f32 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -688,10 +688,10 @@ static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id, static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete) { struct tipc_link_entry *le = &n->links[bearer_id]; + struct tipc_media_addr *maddr = NULL; struct tipc_link *l = le->link; - struct tipc_media_addr *maddr; - struct sk_buff_head xmitq; int old_bearer_id = bearer_id; + struct sk_buff_head xmitq; if (!l) return; @@ -713,7 +713,8 @@ static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete) tipc_node_write_unlock(n); if (delete) tipc_mon_remove_peer(n->net, n->addr, old_bearer_id); - tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr); + if (!skb_queue_empty(&xmitq)) + tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr); tipc_sk_rcv(n->net, &le->inputq); } -- 2.20.1