* security/apparmor/policy_unpack.c:1814:2-8: WARNING: NULL check before some freeing functions is not needed.
@ 2026-11-26 21:18 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-11-26 21:18 UTC (permalink / raw)
To: Maxime Bélair ; +Cc: oe-kbuild-all, linux-kernel, John Johansen
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9437ee8b6cf607e883b36e44bd755968daaebd48
commit: 17b5758bf35c7a113363cd7a350b7e6a251b80f4 apparmor: Initial support for compressed policies
date: 5 months ago
config: arm-randconfig-r2108-20261126 (https://download.01.org/0day-ci/archive/20261126/20261126221434.SFIqjXah-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project a2bea097c8bf336f31f45e88e96f20d88e37ff5a)
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
| Fixes: 17b5758bf35c ("apparmor: Initial support for compressed policies")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261126221434.SFIqjXah-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> security/apparmor/policy_unpack.c:1814:2-8: WARNING: NULL check before some freeing functions is not needed.
vim +1814 security/apparmor/policy_unpack.c
1715
1716 /**
1717 * aa_unpack - unpack packed binary profile(s) data loaded from user space
1718 * @udata: user data copied to kmem (NOT NULL)
1719 * @lh: list to place unpacked profiles in a aa_repl_ws
1720 * @ns: Returns namespace profile is in if specified else NULL (NOT NULL)
1721 * @compressed_data: The userspace-provided compressed data. May be NULL
1722 * @compressed_size: If compressed_data is not NULL, the compressed data size
1723 *
1724 * Unpack user data and return refcounted allocated profile(s) stored in
1725 * @lh in order of discovery, with the list chain stored in base.list
1726 * or error
1727 *
1728 * Returns: profile(s) on @lh else error pointer if fails to unpack
1729 */
1730 int aa_unpack(struct aa_loaddata *udata, struct list_head *lh,
1731 const char **ns, char *compressed_data, size_t compressed_size)
1732 {
1733 struct aa_load_ent *tmp, *ent;
1734 struct aa_profile *profile = NULL;
1735 char *ns_name = NULL;
1736 int error = 0;
1737 struct aa_ext e = {
1738 .start = udata->data,
1739 .end = udata->data + udata->size,
1740 .pos = udata->data,
1741 };
1742
1743 *ns = NULL;
1744 while (e.pos < e.end) {
1745 void *start;
1746 error = verify_header(&e, e.pos == e.start, ns);
1747 if (error)
1748 goto fail;
1749
1750 start = e.pos;
1751 profile = unpack_profile(&e, &ns_name);
1752 if (IS_ERR(profile)) {
1753 error = PTR_ERR(profile);
1754 goto fail;
1755 }
1756
1757 error = verify_profile(profile);
1758 if (error)
1759 goto fail_profile;
1760
1761 if (aa_g_hash_policy)
1762 error = aa_calc_profile_hash(profile, e.version, start,
1763 e.pos - start);
1764 if (error)
1765 goto fail_profile;
1766
1767 ent = aa_load_ent_alloc();
1768 if (!ent) {
1769 error = -ENOMEM;
1770 goto fail_profile;
1771 }
1772
1773 ent->new = profile;
1774 ent->ns_name = ns_name;
1775 ns_name = NULL;
1776 list_add_tail(&ent->list, lh);
1777 }
1778 udata->abi = e.version & K_ABI_MASK;
1779 if (aa_g_hash_policy) {
1780 udata->hash = aa_calc_hash(udata->data, udata->size);
1781 if (IS_ERR(udata->hash)) {
1782 error = PTR_ERR(udata->hash);
1783 udata->hash = NULL;
1784 goto fail;
1785 }
1786 }
1787
1788 if (aa_g_export_binary) {
1789 /* Do we have userspace-compressed data? */
1790 if (compressed_data) {
1791 kvfree(udata->data);
1792 udata->data = compressed_data;
1793 udata->compressed_size = compressed_size;
1794 compressed_data = NULL; /* consumed */
1795
1796 } else
1797 error = compress_loaddata(udata);
1798
1799 if (error)
1800 goto fail;
1801 } else if (compressed_data) {
1802 kvfree(compressed_data);
1803 compressed_data = NULL;
1804 }
1805
1806 return 0;
1807
1808 fail_profile:
1809 kfree(ns_name);
1810 aa_put_profile(profile);
1811
1812 fail:
1813 if (compressed_data)
> 1814 kvfree(compressed_data);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-26 21:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 21:18 security/apparmor/policy_unpack.c:1814:2-8: WARNING: NULL check before some freeing functions is not needed kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®