Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3360492imm; Thu, 17 May 2018 07:35:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZousJa+pZ4QluXpPuB7xRwefEPK0P0iGIZ+LPdNezvxaNMhWKfIu3emppiA2MGVUN72YdHO X-Received: by 2002:a17:902:be0e:: with SMTP id r14-v6mr5469826pls.158.1526567751618; Thu, 17 May 2018 07:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526567751; cv=none; d=google.com; s=arc-20160816; b=OxO4Ewxcu9chz3YZX4jHVqVHcTKYT3ZfJh2Hr0yR9xFoMyVMdT6xCH1lTIpu25XGkA X+3JDnBTXGAnW4jn7DA8+LQ6jCgk1chyWTWlOeGx3fviqLqisLVu9c5kLxxBvI0QsNsK cN3C95aG/mS5LWjRW6KVeC2ccvqbU9VJBOIfXMCRdcK9bbbhb0KBE5zfs2187ehlA0eP XIJbnlAXK3R+qoWPDVVfsNONCXlVnbDhx/0Z10gcI8pNn2EGB+F/g0uR959CsVmzuATB UurjDM4mMS0BFIcG4RALOMUJmJTNDbUd8TksDgwGtyVWp24AfSGGxmA2b/jM+VnhgdF4 l2dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=5hvxk7VQavUUpZo9/5lzl/c6++JDFN1/xEsUEOh3Hjk=; b=xYd9UV9B/r+Tm5U9sz0YWn7miLJgP6e8sYDHVFpjlCThdX+tJtrbpW/SPrqOUKUN2T C0aAOdtDWB8qikpGUZLRE1F4YQ+QghbbCA1eoJhRf1cXGiOdBN3xSkmaQtkZTz12K3uC eREwgcUxvk0Y/ntqThqnboeQkABm6qa0ty9uxEgykDVKk4WZBAoY4YMKUnjylIc9hwVO mnX6QinGGgmj9+MrnPjTXxlget7n7pz4c2v5x638ersp6HFF0EhHzge4VmrWnw65bq16 LaTaqDCGav67xrxq58kDFwd6QEJvi2vCegJ0doi5d6sXk5RGX0vmxhuCZgPoyc7/dgFb LAqw== ARC-Authentication-Results: i=1; mx.google.com; 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 j91-v6si4967635pld.402.2018.05.17.07.35.36; Thu, 17 May 2018 07:35:51 -0700 (PDT) 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; 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 S1752245AbeEQOdp (ORCPT + 99 others); Thu, 17 May 2018 10:33:45 -0400 Received: from gateway20.websitewelcome.com ([192.185.69.18]:36438 "EHLO gateway20.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751647AbeEQOdo (ORCPT ); Thu, 17 May 2018 10:33:44 -0400 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway20.websitewelcome.com (Postfix) with ESMTP id AC800400C57B4 for ; Thu, 17 May 2018 09:08:44 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id JJaGfxZKDQUwqJJaGfeWnI; Thu, 17 May 2018 09:08:44 -0500 X-Authority-Reason: nr=8 Received: from [187.172.56.86] (port=58220 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1fJJaG-000BKQ-5P; Thu, 17 May 2018 09:08:44 -0500 Date: Thu, 17 May 2018 09:08:43 -0500 From: "Gustavo A. R. Silva" To: Alexei Starovoitov , Daniel Borkmann , John Fastabend Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH 1/2] bpf: sockmap, fix uninitialized variable Message-ID: <11073635016901e9e84c2f34f20d412073b26297.1526565461.git.gustavo@embeddedor.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 187.172.56.86 X-Source-L: No X-Exim-ID: 1fJJaG-000BKQ-5P X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [187.172.56.86]:58220 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 10 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a potential execution path in which variable err is returned without being properly initialized previously. Fix this by initializing variable err to 0. Addresses-Coverity-ID: 1468964 ("Uninitialized scalar variable") Fixes: e5cd3abcb31a ("bpf: sockmap, refactor sockmap routines to work with hashmap") Signed-off-by: Gustavo A. R. Silva --- kernel/bpf/sockmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index c6de139..41b41fc 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c @@ -1713,7 +1713,7 @@ static int __sock_map_ctx_update_elem(struct bpf_map *map, struct smap_psock_map_entry *e = NULL; struct smap_psock *psock; bool new = false; - int err; + int err = 0; /* 1. If sock map has BPF programs those will be inherited by the * sock being added. If the sock is already attached to BPF programs -- 2.7.4