arch/mips/boot/compressed/../../../../lib/decompress_unlzo.c:46:5: warning: variable 'level' set but not used

From: kernel test robot
Date: Tue May 04 2021 - 23:58:00 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d665ea6ea86c785760ee4bad4543dab3267ad074
commit: baec970aa5ba11099ad7a91773350c91fb2113f0 mips: Add N64 machine type
date: 3 months ago
config: mips-randconfig-r015-20210505 (attached as .config)
compiler: mips64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=baec970aa5ba11099ad7a91773350c91fb2113f0
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout baec970aa5ba11099ad7a91773350c91fb2113f0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

arch/mips/boot/compressed/decompress.c:38:6: warning: no previous prototype for 'error' [-Wmissing-prototypes]
38 | void error(char *x)
| ^~~~~
In file included from arch/mips/boot/compressed/decompress.c:68:
arch/mips/boot/compressed/../../../../lib/decompress_unlzo.c: In function 'parse_header':
>> arch/mips/boot/compressed/../../../../lib/decompress_unlzo.c:46:5: warning: variable 'level' set but not used [-Wunused-but-set-variable]
46 | u8 level = 0;
| ^~~~~
arch/mips/boot/compressed/decompress.c: At top level:
arch/mips/boot/compressed/decompress.c:81:6: warning: no previous prototype for '__stack_chk_fail' [-Wmissing-prototypes]
81 | void __stack_chk_fail(void)
| ^~~~~~~~~~~~~~~~
arch/mips/boot/compressed/decompress.c:86:6: warning: no previous prototype for 'decompress_kernel' [-Wmissing-prototypes]
86 | void decompress_kernel(unsigned long boot_heap_start)
| ^~~~~~~~~~~~~~~~~


vim +/level +46 arch/mips/boot/compressed/../../../../lib/decompress_unlzo.c

7dd65feb6c603e Albin Tonnerre 2010-01-08 40
d97b07c54f34e8 Yinghai Lu 2014-08-08 41 STATIC inline long INIT parse_header(u8 *input, long *skip, long in_len)
7dd65feb6c603e Albin Tonnerre 2010-01-08 42 {
7dd65feb6c603e Albin Tonnerre 2010-01-08 43 int l;
7dd65feb6c603e Albin Tonnerre 2010-01-08 44 u8 *parse = input;
5a3f81a7029daf Lasse Collin 2011-01-12 45 u8 *end = input + in_len;
7dd65feb6c603e Albin Tonnerre 2010-01-08 @46 u8 level = 0;
7dd65feb6c603e Albin Tonnerre 2010-01-08 47 u16 version;
7dd65feb6c603e Albin Tonnerre 2010-01-08 48
5a3f81a7029daf Lasse Collin 2011-01-12 49 /*
5a3f81a7029daf Lasse Collin 2011-01-12 50 * Check that there's enough input to possibly have a valid header.
5a3f81a7029daf Lasse Collin 2011-01-12 51 * Then it is possible to parse several fields until the minimum
5a3f81a7029daf Lasse Collin 2011-01-12 52 * size may have been used.
5a3f81a7029daf Lasse Collin 2011-01-12 53 */
5a3f81a7029daf Lasse Collin 2011-01-12 54 if (in_len < HEADER_SIZE_MIN)
5a3f81a7029daf Lasse Collin 2011-01-12 55 return 0;
5a3f81a7029daf Lasse Collin 2011-01-12 56
7dd65feb6c603e Albin Tonnerre 2010-01-08 57 /* read magic: 9 first bits */
7dd65feb6c603e Albin Tonnerre 2010-01-08 58 for (l = 0; l < 9; l++) {
7dd65feb6c603e Albin Tonnerre 2010-01-08 59 if (*parse++ != lzop_magic[l])
7dd65feb6c603e Albin Tonnerre 2010-01-08 60 return 0;
7dd65feb6c603e Albin Tonnerre 2010-01-08 61 }
7dd65feb6c603e Albin Tonnerre 2010-01-08 62 /* get version (2bytes), skip library version (2),
7dd65feb6c603e Albin Tonnerre 2010-01-08 63 * 'need to be extracted' version (2) and
7dd65feb6c603e Albin Tonnerre 2010-01-08 64 * method (1) */
7dd65feb6c603e Albin Tonnerre 2010-01-08 65 version = get_unaligned_be16(parse);
7dd65feb6c603e Albin Tonnerre 2010-01-08 66 parse += 7;
7dd65feb6c603e Albin Tonnerre 2010-01-08 67 if (version >= 0x0940)
7dd65feb6c603e Albin Tonnerre 2010-01-08 68 level = *parse++;
7dd65feb6c603e Albin Tonnerre 2010-01-08 69 if (get_unaligned_be32(parse) & HEADER_HAS_FILTER)
7dd65feb6c603e Albin Tonnerre 2010-01-08 70 parse += 8; /* flags + filter info */
7dd65feb6c603e Albin Tonnerre 2010-01-08 71 else
7dd65feb6c603e Albin Tonnerre 2010-01-08 72 parse += 4; /* flags */
7dd65feb6c603e Albin Tonnerre 2010-01-08 73
5a3f81a7029daf Lasse Collin 2011-01-12 74 /*
5a3f81a7029daf Lasse Collin 2011-01-12 75 * At least mode, mtime_low, filename length, and checksum must
5a3f81a7029daf Lasse Collin 2011-01-12 76 * be left to be parsed. If also mtime_high is present, it's OK
5a3f81a7029daf Lasse Collin 2011-01-12 77 * because the next input buffer check is after reading the
5a3f81a7029daf Lasse Collin 2011-01-12 78 * filename length.
5a3f81a7029daf Lasse Collin 2011-01-12 79 */
5a3f81a7029daf Lasse Collin 2011-01-12 80 if (end - parse < 8 + 1 + 4)
5a3f81a7029daf Lasse Collin 2011-01-12 81 return 0;
5a3f81a7029daf Lasse Collin 2011-01-12 82
7dd65feb6c603e Albin Tonnerre 2010-01-08 83 /* skip mode and mtime_low */
7dd65feb6c603e Albin Tonnerre 2010-01-08 84 parse += 8;
7dd65feb6c603e Albin Tonnerre 2010-01-08 85 if (version >= 0x0940)
7dd65feb6c603e Albin Tonnerre 2010-01-08 86 parse += 4; /* skip mtime_high */
7dd65feb6c603e Albin Tonnerre 2010-01-08 87
7dd65feb6c603e Albin Tonnerre 2010-01-08 88 l = *parse++;
7dd65feb6c603e Albin Tonnerre 2010-01-08 89 /* don't care about the file name, and skip checksum */
5a3f81a7029daf Lasse Collin 2011-01-12 90 if (end - parse < l + 4)
5a3f81a7029daf Lasse Collin 2011-01-12 91 return 0;
7dd65feb6c603e Albin Tonnerre 2010-01-08 92 parse += l + 4;
7dd65feb6c603e Albin Tonnerre 2010-01-08 93
7dd65feb6c603e Albin Tonnerre 2010-01-08 94 *skip = parse - input;
7dd65feb6c603e Albin Tonnerre 2010-01-08 95 return 1;
7dd65feb6c603e Albin Tonnerre 2010-01-08 96 }
7dd65feb6c603e Albin Tonnerre 2010-01-08 97

:::::: The code at line 46 was first introduced by commit
:::::: 7dd65feb6c603e13eba501c34c662259ab38e70e lib: add support for LZO-compressed kernels

:::::: TO: Albin Tonnerre <albin.tonnerre@xxxxxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip