Skip to content

Commit 102ada7

Browse files
committed
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 <lkp@intel.com> 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: c140dcd ("apparmor: make str table more generic and be able to have multiple entries") Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent 3734b94 commit 102ada7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

security/apparmor/policy_unpack.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ static int process_strs_entry(char *str, int size, bool multi)
474474
if (!*str) {
475475
AA_DEBUG(DEBUG_UNPACK,
476476
"starting with null save=%lu size %d c=%d",
477-
str - save, size, c);
477+
(unsigned long)(str - save), size, c);
478478
return -4;
479479
}
480480
if (isspace(*str))
@@ -545,7 +545,8 @@ static int unpack_strs_table(struct aa_ext *e, const char *name, bool multi,
545545
c = process_strs_entry(str, size2, multi);
546546
if (c <= 0) {
547547
AA_DEBUG(DEBUG_UNPACK, "process_strs %d i %d pos %ld",
548-
c, i, e->pos - saved_pos);
548+
c, i,
549+
(unsigned_long) e->pos - saved_pos);
549550
goto fail;
550551
}
551552
if (!multi && c > 1) {

0 commit comments

Comments
 (0)