[jj-apparmor:apparmor-next 10/10] security/apparmor/apparmorfs.c:586:12: warning: 'decompress_zstd' defined but not used

kernel test robot <[email protected]> Sun, 02 Aug 2026 06:50:54 +0800
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor.git apparmor-next
head:   b0c2e98d291b9db03dcbaddd38d3a33428b098a8
commit: b0c2e98d291b9db03dcbaddd38d3a33428b098a8 [10/10] apparmor: fix implicit declaration of function 'decompress_zstd'
config: xtensa-randconfig-002-20260802 (https://download.01.org/0day-ci/archive/20260802/[email protected]/config)
compiler: xtensa-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260802/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> security/apparmor/apparmorfs.c:586:12: warning: 'decompress_zstd' defined but not used [-Wunused-function]
     586 | static int decompress_zstd(char *src __always_unused,
         |            ^~~~~~~~~~~~~~~


vim +/decompress_zstd +586 security/apparmor/apparmorfs.c

   522	
   523	/**
   524	 * aa_get_data_from_compressed - common routine for getting compressed policy
   525	 * from user and get both compressed and uncompressed version.
   526	 * @userbuf: user buffer to copy data from  (NOT NULL)
   527	 * @buffer_size: size of user buffer
   528	 * @pos: position write is at in the file (NOT NULL)
   529	 * @compressed_data: Ptr on compressed data. *compressed_data is allocated there
   530	 *
   531	 * Returns: kernel buffer containing copy of user buffer data or an
   532	 *          ERR_PTR on failure.
   533	 */
   534	
   535	static struct aa_loaddata *aa_get_data_from_compressed(const char __user *userbuf,
   536							  size_t buffer_size,
   537							  loff_t *pos,
   538							  char **compressed_data)
   539	{
   540		struct aa_loaddata *data;
   541		zstd_frame_header header;
   542		int error;
   543	
   544		if (!userbuf || !pos)
   545			return ERR_PTR(-EINVAL);
   546		if (*pos)
   547			return ERR_PTR(-ESPIPE);
   548	
   549		*compressed_data = kvmalloc(buffer_size, GFP_KERNEL);
   550		if (!*compressed_data)
   551			return ERR_PTR(-ENOMEM);
   552		error = copy_from_user(*compressed_data, userbuf, buffer_size);
   553		if (error)
   554			goto fail;
   555	
   556		error = zstd_get_frame_header(&header, *compressed_data, buffer_size);
   557		if (error || header.frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN ||
   558		    header.frameContentSize == ZSTD_CONTENTSIZE_ERROR) {
   559			error = -EINVAL;
   560			goto fail;
   561		}
   562	
   563		data = aa_loaddata_alloc(header.frameContentSize);
   564		if (IS_ERR(data)) {
   565			error = PTR_ERR(data);
   566			goto fail;
   567		}
   568	
   569		// We then decompress the data
   570		error = decompress_zstd(*compressed_data, buffer_size, data->data,
   571					header.frameContentSize);
   572		if (error)
   573			goto fail_decompress;
   574	
   575		data->size = header.frameContentSize;
   576		return data;
   577	
   578	fail_decompress:
   579		aa_put_i_loaddata(data);
   580	fail:
   581		kvfree(*compressed_data);
   582		return ERR_PTR(error);
   583	
   584	}
   585	#else
 > 586	static int decompress_zstd(char *src __always_unused,
   587				   size_t slen __always_unused,
   588				   char *dst __always_unused,
   589				   size_t dlen __always_unused)
   590	{
   591		return -EINVAL;
   592	}
   593	

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