0 day kernel build service
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [linux-next:master 1673/2307] security/apparmor/apparmorfs.c:590 policy_update() warn: passing zero to 'PTR_ERR'
Date: Wed, 01 Jul 2026 14:50:34 +0800	[thread overview]
Message-ID: <202607011451.icwPyCIk-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: "Maxime Bélair" <maxime.belair@canonical.com>
CC: John Johansen <john.johansen@canonical.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   be5c93fa674f0fc3c8f359c2143abce6bbb422e6
commit: 17b5758bf35c7a113363cd7a350b7e6a251b80f4 [1673/2307] apparmor: Initial support for compressed policies
:::::: branch date: 13 hours ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-161-20260701 (https://download.01.org/0day-ci/archive/20260701/202607011451.icwPyCIk-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
smatch: v0.5.0-9185-gbcc58b9c

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202607011451.icwPyCIk-lkp@intel.com/

smatch warnings:
security/apparmor/apparmorfs.c:590 policy_update() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +590 security/apparmor/apparmorfs.c

63e2b423771ab0 John Johansen 2010-07-29  548  
18e99f191a8e66 John Johansen 2017-05-26  549  static ssize_t policy_update(u32 mask, const char __user *buf, size_t size,
6601e13e828418 John Johansen 2025-11-07  550  			     loff_t *pos, struct aa_ns *ns,
6601e13e828418 John Johansen 2025-11-07  551  			     const struct cred *ocred)
63e2b423771ab0 John Johansen 2010-07-29  552  {
5ac8c355ae0013 John Johansen 2017-01-16  553  	struct aa_loaddata *data;
637f688dc3dc30 John Johansen 2017-06-09  554  	struct aa_label *label;
637f688dc3dc30 John Johansen 2017-06-09  555  	ssize_t error;
17b5758bf35c7a Maxime Bélair 2024-02-01  556  	char *compressed_data = NULL;
17b5758bf35c7a Maxime Bélair 2024-02-01  557  	__le32 magic_le;
17b5758bf35c7a Maxime Bélair 2024-02-01  558  	bool is_compressed;
cf797c0e5e3125 John Johansen 2017-06-09  559  
637f688dc3dc30 John Johansen 2017-06-09  560  	label = begin_current_label_crit_section();
cf797c0e5e3125 John Johansen 2017-06-09  561  
5ac8c355ae0013 John Johansen 2017-01-16  562  	/* high level check about policy management - fine grained in
5ac8c355ae0013 John Johansen 2017-01-16  563  	 * below after unpack
5ac8c355ae0013 John Johansen 2017-01-16  564  	 */
6601e13e828418 John Johansen 2025-11-07  565  	error = aa_may_manage_policy(current_cred(), label, ns, ocred, mask);
5ac8c355ae0013 John Johansen 2017-01-16  566  	if (error)
c6b39f070722ea Xiyu Yang     2020-04-20  567  		goto end_section;
63e2b423771ab0 John Johansen 2010-07-29  568  
17b5758bf35c7a Maxime Bélair 2024-02-01  569  	/* If the policy is userspace compressed we start by decompressing it
17b5758bf35c7a Maxime Bélair 2024-02-01  570  	 * to make the required checks (computing hash, verifying profile, ...)
17b5758bf35c7a Maxime Bélair 2024-02-01  571  	 *
17b5758bf35c7a Maxime Bélair 2024-02-01  572  	 * Getting a userspace-compressed version then decompressing it in the
17b5758bf35c7a Maxime Bélair 2024-02-01  573  	 * kernel actually makes sense since zstd decompression is ~3.5x faster
17b5758bf35c7a Maxime Bélair 2024-02-01  574  	 * than compression. This also allow to increase the compression level.
17b5758bf35c7a Maxime Bélair 2024-02-01  575  	 */
17b5758bf35c7a Maxime Bélair 2024-02-01  576  
17b5758bf35c7a Maxime Bélair 2024-02-01  577  	if (size >= sizeof(__le32) &&
17b5758bf35c7a Maxime Bélair 2024-02-01  578  	    !copy_from_user(&magic_le, buf, sizeof(magic_le)) &&
17b5758bf35c7a Maxime Bélair 2024-02-01  579  	    le32_to_cpu(magic_le) == ZSTD_MAGICNUMBER)
17b5758bf35c7a Maxime Bélair 2024-02-01  580  		is_compressed = true;
17b5758bf35c7a Maxime Bélair 2024-02-01  581  	else
17b5758bf35c7a Maxime Bélair 2024-02-01  582  		is_compressed = false;
17b5758bf35c7a Maxime Bélair 2024-02-01  583  
17b5758bf35c7a Maxime Bélair 2024-02-01  584  	if (is_compressed) {
17b5758bf35c7a Maxime Bélair 2024-02-01  585  
17b5758bf35c7a Maxime Bélair 2024-02-01  586  		data = aa_get_data_from_compressed(buf, size, pos, &compressed_data);
17b5758bf35c7a Maxime Bélair 2024-02-01  587  		error = PTR_ERR(data);
17b5758bf35c7a Maxime Bélair 2024-02-01  588  	} else {
5ef50d014c5924 John Johansen 2017-01-16  589  		data = aa_simple_write_to_buffer(buf, size, size, pos);
63e2b423771ab0 John Johansen 2010-07-29 @590  		error = PTR_ERR(data);
17b5758bf35c7a Maxime Bélair 2024-02-01  591  	}
17b5758bf35c7a Maxime Bélair 2024-02-01  592  
63e2b423771ab0 John Johansen 2010-07-29  593  	if (!IS_ERR(data)) {
17b5758bf35c7a Maxime Bélair 2024-02-01  594  		error = aa_replace_profiles(ns, label, mask, data,
17b5758bf35c7a Maxime Bélair 2024-02-01  595  					    compressed_data, size);
a0b7091c4de45a John Johansen 2026-02-24  596  		/* put pcount, which will put count and free if no
a0b7091c4de45a John Johansen 2026-02-24  597  		 * profiles referencing it.
a0b7091c4de45a John Johansen 2026-02-24  598  		 */
a0b7091c4de45a John Johansen 2026-02-24  599  		aa_put_profile_loaddata(data);
63e2b423771ab0 John Johansen 2010-07-29  600  	}
c6b39f070722ea Xiyu Yang     2020-04-20  601  end_section:
637f688dc3dc30 John Johansen 2017-06-09  602  	end_current_label_crit_section(label);
63e2b423771ab0 John Johansen 2010-07-29  603  
63e2b423771ab0 John Johansen 2010-07-29  604  	return error;
63e2b423771ab0 John Johansen 2010-07-29  605  }
63e2b423771ab0 John Johansen 2010-07-29  606  

:::::: The code at line 590 was first introduced by commit
:::::: 63e2b423771ab0bc7ad4d407f3f6517c6d05cdc0 AppArmor: userspace interfaces

:::::: TO: John Johansen <john.johansen@canonical.com>
:::::: CC: James Morris <jmorris@namei.org>

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

                 reply	other threads:[~2026-07-01  6:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202607011451.icwPyCIk-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox