mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-18 13:04:18 +00:00
sbitmap: initialize weight to zero
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 Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
5c64a8df0c
commit
60658e0dc1
1 changed files with 1 additions and 1 deletions
|
@ -169,7 +169,7 @@ EXPORT_SYMBOL_GPL(sbitmap_any_bit_clear);
|
|||
|
||||
unsigned int sbitmap_weight(const struct sbitmap *sb)
|
||||
{
|
||||
unsigned int i, weight;
|
||||
unsigned int i, weight = 0;
|
||||
|
||||
for (i = 0; i < sb->map_nr; i++) {
|
||||
const struct sbitmap_word *word = &sb->map[i];
|
||||
|
|
Loading…
Add table
Reference in a new issue