Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932519AbcKPQAS (ORCPT ); Wed, 16 Nov 2016 11:00:18 -0500 Received: from www62.your-server.de ([213.133.104.62]:41737 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270AbcKPQAR (ORCPT ); Wed, 16 Nov 2016 11:00:17 -0500 Message-ID: <582C828A.60605@iogearbox.net> Date: Wed, 16 Nov 2016 17:00:10 +0100 From: Daniel Borkmann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Arnd Bergmann , Alexei Starovoitov CC: Martin KaFai Lau , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bpf: fix possible uninitialized access in inactive rotation References: <20161116143836.2448688-1-arnd@arndb.de> In-Reply-To: <20161116143836.2448688-1-arnd@arndb.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 788 Lines: 19 On 11/16/2016 03:38 PM, Arnd Bergmann wrote: > This newly added code causes a build warning: > > kernel/bpf/bpf_lru_list.c: In function '__bpf_lru_list_rotate_inactive': > kernel/bpf/bpf_lru_list.c:201:28: error: 'next' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > The warning is plausible from looking at the code, though there might > be non-obvious external constraints that ensure it always works. > > Moving the assignment of ->next_inactive_rotation inside of the > loop makes it obvious to the reader and the compiler when we > actually want to update ->next. > > Fixes: 3a08c2fd7634 ("bpf: LRU List") > Signed-off-by: Arnd Bergmann Thanks a lot, Arnd, patch was already sent here though: http://patchwork.ozlabs.org/patch/695202/