Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1486551

Re: [PATCH] sbitmap: avoid maybe-uninitialized warning

From Jens Axboe <axboe@kernel.dk>
Newsgroups linux.kernel
Subject Re: [PATCH] sbitmap: avoid maybe-uninitialized warning
Date 2016-09-19 16:50 +0200
Message-ID <sj83o-6ES-23@gated-at.bofh.it> (permalink)
References <sj61A-5sG-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] sbitmap: avoid maybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-09-19 14:40 +0200
  Re: [PATCH] sbitmap: avoid maybe-uninitialized warning Jens Axboe <axboe@kernel.dk> - 2016-09-19 16:50 +0200
    Re: [PATCH] sbitmap: avoid maybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-09-19 17:20 +0200
      Re: [PATCH] sbitmap: avoid maybe-uninitialized warning Jens Axboe <axboe@kernel.dk> - 2016-09-19 17:30 +0200
        Re: [PATCH] sbitmap: avoid maybe-uninitialized warning Omar Sandoval <osandov@osandov.com> - 2016-09-19 17:50 +0200

csiph-web