Re: [PATCH] selinux: fix pr_err() format specifier in ebitmap_read()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 27 Mar 2024 at 16:52, Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
>
> Correct the use of integer specifiers when printing ebitmap and
> ebitmap_node information.
>
> Fixes: 0142c56682fb ("selinux: reject invalid ebitmaps")
> Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> Signed-off-by: Paul Moore <paul@xxxxxxxxxxxxxx>
> ---
>  security/selinux/ss/ebitmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c
> index f1ba333f127d..13d5fb47a2bb 100644
> --- a/security/selinux/ss/ebitmap.c
> +++ b/security/selinux/ss/ebitmap.c
> @@ -461,7 +461,7 @@ int ebitmap_read(struct ebitmap *e, void *fp)
>         }
>
>         if (n && n->startbit + EBITMAP_SIZE != e->highbit) {
> -               pr_err("SELinux: ebitmap: high bit %d is not equal to the expected value %ld\n",
> +               pr_err("SELinux: ebitmap: high bit %u is not equal to the expected value %lu\n",
>                        e->highbit, n->startbit + EBITMAP_SIZE);

Maybe %zu is more appropriate for the second argument?
`n->startbit + EBITMAP_SIZE` should be of type size_t since
EBITMAP_SIZE is computed via sizeof().

See https://www.kernel.org/doc/html/v6.8/core-api/printk-formats.html

>                 goto bad;
>         }
> --
> 2.44.0
>
>




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux