From: John Johansen Date: Mon, 2 Feb 2026 11:45:21 +0000 (-0800) Subject: apparmor: fix fmt string type error in process_strs_entry X-Git-Tag: v7.0-rc1~35^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=102ada7ca37ed8358bd70c6f8e6475ebacf6f76d;p=thirdparty%2Fkernel%2Fstable.git apparmor: fix fmt string type error in process_strs_entry pointer subtraction has a type of int when using clang on hexagon, microblaze (and possibly other archs). We know the subtraction is postive so cast the expression to unsigned long to match what is in the fmt string. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202602021429.CcmWkR9K-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202602021427.PvvDjgyL-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202602021510.JPzX5zKb-lkp@intel.com/ Fixes: c140dcd1246bf ("apparmor: make str table more generic and be able to have multiple entries") Signed-off-by: John Johansen --- diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index f86133f36f33..175445c09896 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -474,7 +474,7 @@ static int process_strs_entry(char *str, int size, bool multi) if (!*str) { AA_DEBUG(DEBUG_UNPACK, "starting with null save=%lu size %d c=%d", - str - save, size, c); + (unsigned long)(str - save), size, c); return -4; } if (isspace(*str)) @@ -545,7 +545,8 @@ static int unpack_strs_table(struct aa_ext *e, const char *name, bool multi, c = process_strs_entry(str, size2, multi); if (c <= 0) { AA_DEBUG(DEBUG_UNPACK, "process_strs %d i %d pos %ld", - c, i, e->pos - saved_pos); + c, i, + (unsigned_long) e->pos - saved_pos); goto fail; } if (!multi && c > 1) {