From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751042AbcISOnV (ORCPT ); Mon, 19 Sep 2016 10:43:21 -0400 Received: from mail-io0-f178.google.com ([209.85.223.178]:33415 "EHLO mail-io0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751725AbcISOnU (ORCPT ); Mon, 19 Sep 2016 10:43:20 -0400 Subject: Re: [PATCH] sbitmap: avoid maybe-uninitialized warning To: Arnd Bergmann References: <20160919123359.1225305-1-arnd@arndb.de> Cc: Omar Sandoval , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org From: Jens Axboe Message-ID: <6efcc3e0-b85f-9612-2562-d37922a1dc92@kernel.dk> Date: Mon, 19 Sep 2016 08:43:12 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160919123359.1225305-1-arnd@arndb.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/19/2016 06:33 AM, Arnd Bergmann wrote: > The sbitmap code that has just been turned into a library module > returns uninitialized data for sbitmap_weight(), as pointed out by > gcc when building with -Wmaybe-uninitialized: > > lib/sbitmap.c: In function 'sbitmap_weight': > lib/sbitmap.c:179:9: error: 'weight' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > Note that the value is never initialized, we just add data on > top, so it is wrong regardless of sb->map_nr. > > This adds the missing initialization. Thanks Arnd, Colin sent the same patch and I applied it. Note that: > Fixes: 88459642cba4 ("blk-mq: abstract tag allocation out into sbitmap library") that isn't truly correct, that patch is just what moved the code. The bug predates that commit. -- Jens Axboe