Hello Dennis Zhou,
The patch a67dc67a2cb8: "btrfs: change set_level() to bound the level
passed in" from Jan 28, 2019, leads to the following static checker
warning:
fs/btrfs/compression.c:1576 btrfs_compress_str2level()
error: uninitialized symbol 'level'.
fs/btrfs/compression.c
1566 unsigned int btrfs_compress_str2level(unsigned int type, const char *str)
1567 {
1568 unsigned int level;
1569 int ret;
1570
1571 if (!type)
1572 return 0;
1573
1574 if (str[0] == ':') {
1575 ret = kstrtouint(str + 1, 10, &level);
--> 1576 if (ret)
1577 level = 0;
I feel like if the user gives bad input then we should just return an
error code instead of picking a level.
1578 }
level is not initialized if the first character is not ':'.
1579
1580 level = btrfs_compress_op[type]->set_level(level);
1581
1582 return level;
1583 }
regards,
dan carpenter