linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [akpm-mm:mm-nonmm-unstable 87/91] lib/base64.c:36:28: sparse: sparse: Initializer entry defined twice
@ 2025-11-02  5:36 kernel test robot
  2025-11-02 13:42 ` Kuan-Wei Chiu
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2025-11-02  5:36 UTC (permalink / raw)
  To: Kuan-Wei Chiu
  Cc: oe-kbuild-all, Andrew Morton, Linux Memory Management List, Guan-Chun Wu

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
head:   97751db460a7c6988b2ab988d9889d4309f9cc8c
commit: 5b693a7ad2acfa88e8ab0a047335ea4c94fecdb1 [87/91] lib/base64: optimize base64_decode() with reverse lookup tables
config: m68k-randconfig-r123-20251102 (https://download.01.org/0day-ci/archive/20251102/202511021343.107utehN-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251102/202511021343.107utehN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511021343.107utehN-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> lib/base64.c:36:28: sparse: sparse: Initializer entry defined twice
   lib/base64.c:36:28: sparse:   also defined here
   lib/base64.c:37:25: sparse: sparse: Initializer entry defined twice
   lib/base64.c:37:25: sparse:   also defined here

vim +36 lib/base64.c

    33	
    34	static const s8 base64_rev_maps[][256] = {
    35		[BASE64_STD] = BASE64_REV_INIT('+', '/'),
  > 36		[BASE64_URLSAFE] = BASE64_REV_INIT('-', '_'),
    37		[BASE64_IMAP] = BASE64_REV_INIT('+', ',')
    38	};
    39	/**
    40	 * base64_encode() - Base64-encode some binary data
    41	 * @src: the binary data to encode
    42	 * @srclen: the length of @src in bytes
    43	 * @dst: (output) the Base64-encoded string.  Not NUL-terminated.
    44	 * @padding: whether to append '=' padding characters
    45	 * @variant: which base64 variant to use
    46	 *
    47	 * Encodes data using the selected Base64 variant.
    48	 *
    49	 * Return: the length of the resulting Base64-encoded string in bytes.
    50	 */
    51	int base64_encode(const u8 *src, int srclen, char *dst, bool padding, enum base64_variant variant)
    52	{
    53		u32 ac = 0;
    54		int bits = 0;
    55		int i;
    56		char *cp = dst;
    57		const char *base64_table = base64_tables[variant];
    58	
    59		for (i = 0; i < srclen; i++) {
    60			ac = (ac << 8) | src[i];
    61			bits += 8;
    62			do {
    63				bits -= 6;
    64				*cp++ = base64_table[(ac >> bits) & 0x3f];
    65			} while (bits >= 6);
    66		}
    67		if (bits) {
    68			*cp++ = base64_table[(ac << (6 - bits)) & 0x3f];
    69			bits -= 6;
    70		}
    71		if (padding) {
    72			while (bits < 0) {
    73				*cp++ = '=';
    74				bits += 2;
    75			}
    76		}
    77		return cp - dst;
    78	}
    79	EXPORT_SYMBOL_GPL(base64_encode);
    80	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-02 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-02  5:36 [akpm-mm:mm-nonmm-unstable 87/91] lib/base64.c:36:28: sparse: sparse: Initializer entry defined twice kernel test robot
2025-11-02 13:42 ` Kuan-Wei Chiu
2025-11-02 14:42   ` David Laight
2025-11-02 14:57     ` Kuan-Wei Chiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox