Skip to content

Commit 4b3124d

Browse files
cgzonespcmoore
authored andcommitted
selinux: update numeric format specifiers for ebitmaps
Use the correct, according to Documentation/core-api/printk-formats.rst, format specifiers for numeric arguments in string formatting. The general bit type is u32 thus use %u, EBITMAP_SIZE is a constant computed via sizeof() thus use %zu. Fixes: 0142c56 ("selinux: reject invalid ebitmaps") Reported-by: Stephen Rothwell <[email protected]> Closes: https://lore.kernel.org/linux-next/[email protected]/ Signed-off-by: Christian Göttsche <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 42c7732 commit 4b3124d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

security/selinux/ss/ebitmap.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ int ebitmap_read(struct ebitmap *e, void *fp)
381381

382382
if (mapunit != BITS_PER_U64) {
383383
pr_err("SELinux: ebitmap: map size %u does not "
384-
"match my size %zd (high bit was %d)\n",
384+
"match my size %zd (high bit was %u)\n",
385385
mapunit, BITS_PER_U64, e->highbit);
386386
goto bad;
387387
}
@@ -407,13 +407,13 @@ int ebitmap_read(struct ebitmap *e, void *fp)
407407
startbit = le32_to_cpu(ebitmap_start);
408408

409409
if (startbit & (mapunit - 1)) {
410-
pr_err("SELinux: ebitmap start bit (%d) is "
410+
pr_err("SELinux: ebitmap start bit (%u) is "
411411
"not a multiple of the map unit size (%u)\n",
412412
startbit, mapunit);
413413
goto bad;
414414
}
415415
if (startbit > e->highbit - mapunit) {
416-
pr_err("SELinux: ebitmap start bit (%d) is "
416+
pr_err("SELinux: ebitmap start bit (%u) is "
417417
"beyond the end of the bitmap (%u)\n",
418418
startbit, (e->highbit - mapunit));
419419
goto bad;
@@ -436,8 +436,8 @@ int ebitmap_read(struct ebitmap *e, void *fp)
436436
e->node = tmp;
437437
n = tmp;
438438
} else if (startbit <= n->startbit) {
439-
pr_err("SELinux: ebitmap: start bit %d"
440-
" comes after start bit %d\n",
439+
pr_err("SELinux: ebitmap: start bit %u"
440+
" comes after start bit %u\n",
441441
startbit, n->startbit);
442442
goto bad;
443443
}
@@ -461,7 +461,7 @@ int ebitmap_read(struct ebitmap *e, void *fp)
461461
}
462462

463463
if (n && n->startbit + EBITMAP_SIZE != e->highbit) {
464-
pr_err("SELinux: ebitmap: high bit %d is not equal to the expected value %ld\n",
464+
pr_err("SELinux: ebitmap: high bit %u is not equal to the expected value %zu\n",
465465
e->highbit, n->startbit + EBITMAP_SIZE);
466466
goto bad;
467467
}

0 commit comments

Comments
 (0)