Re: [PATCH 3/3] btrfs: Replace kmap() with kmap_local_page() in zlib.c

From: Fabio M. De Francesco
Date: Wed Jun 01 2022 - 16:46:55 EST


On martedì 31 maggio 2022 22:35:30 CEST kernel test robot wrote:
> Hi "Fabio,
>
> Thank you for the patch! Perhaps something to improve:
>

[snip]

> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> >> fs/btrfs/zlib.c:125:6: warning: variable 'data_in' is used
uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> if (out_page == NULL) {
> ^~~~~~~~~~~~~~~~
> fs/btrfs/zlib.c:270:6: note: uninitialized use occurs here
> if (data_in) {
> ^~~~~~~
> fs/btrfs/zlib.c:125:2: note: remove the 'if' if its condition is
always false
> if (out_page == NULL) {
> ^~~~~~~~~~~~~~~~~~~~~~~
> fs/btrfs/zlib.c:115:6: warning: variable 'data_in' is used
uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> if (Z_OK != zlib_deflateInit(&workspace->strm, workspace-
>level)) {
>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/zlib.h:148:25: note: expanded from macro 'Z_OK'
> #define Z_OK 0
> ^
> fs/btrfs/zlib.c:270:6: note: uninitialized use occurs here
> if (data_in) {
> ^~~~~~~
> fs/btrfs/zlib.c:115:2: note: remove the 'if' if its condition is
always false
> if (Z_OK != zlib_deflateInit(&workspace->strm, workspace-
>level)) {
>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> fs/btrfs/zlib.c:100:15: note: initialize the variable 'data_in' to
silence this warning
> char *data_in;
> ^
> = NULL
> >> fs/btrfs/zlib.c:125:6: warning: variable 'cpage_out' is used
uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> if (out_page == NULL) {
> ^~~~~~~~~~~~~~~~
> fs/btrfs/zlib.c:267:6: note: uninitialized use occurs here
> if (cpage_out)
> ^~~~~~~~~
> fs/btrfs/zlib.c:125:2: note: remove the 'if' if its condition is
always false
> if (out_page == NULL) {
> ^~~~~~~~~~~~~~~~~~~~~~~
> fs/btrfs/zlib.c:115:6: warning: variable 'cpage_out' is used
uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> if (Z_OK != zlib_deflateInit(&workspace->strm, workspace-
>level)) {
>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/zlib.h:148:25: note: expanded from macro 'Z_OK'
> #define Z_OK 0
> ^
> fs/btrfs/zlib.c:267:6: note: uninitialized use occurs here
> if (cpage_out)
> ^~~~~~~~~
> fs/btrfs/zlib.c:115:2: note: remove the 'if' if its condition is
always false
> if (Z_OK != zlib_deflateInit(&workspace->strm, workspace-
>level)) {
>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> fs/btrfs/zlib.c:101:17: note: initialize the variable 'cpage_out' to
silence this warning
> char *cpage_out;
> ^
> = NULL
> 4 warnings generated.

I'll initialize these variables in v2.

Thanks,

Fabio