From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752254AbcISOU6 (ORCPT ); Mon, 19 Sep 2016 10:20:58 -0400 Received: from mail-io0-f173.google.com ([209.85.223.173]:36343 "EHLO mail-io0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750970AbcISOUs (ORCPT ); Mon, 19 Sep 2016 10:20:48 -0400 Subject: Re: [PATCH] sbitmap: initialize weight to zero To: Colin King , linux-block@vger.kernel.org References: <20160919133408.25559-1-colin.king@canonical.com> Cc: linux-kernel@vger.kernel.org From: Jens Axboe Message-ID: Date: Mon, 19 Sep 2016 08:20:45 -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: <20160919133408.25559-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8; 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 07:34 AM, Colin King wrote: > From: Colin Ian King > > Variable weight is not being initialized to zero before it is > used to compute the weight sum. Ensure it is initialized to zero. > > Found with static analysis with cppcheck: > [lib/sbitmap.c:177]: (error) Uninitialized variable: weight Thanks, applied. Strange, this is an old issue, it was just moved to this file. It should have triggered on mainline too. My compiler doesn't complain here: $ gcc --version gcc (Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901 -- Jens Axboe