Message ID | 20240327155201.117066-2-paul@paul-moore.com (mailing list archive) |
---|---|
State | Rejected |
Delegated to: | Paul Moore |
Headers | show |
Series | selinux: fix pr_err() format specifier in ebitmap_read() | expand |
On Wed, 27 Mar 2024 at 16:52, Paul Moore <paul@paul-moore.com> 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@canb.auug.org.au> > Signed-off-by: Paul Moore <paul@paul-moore.com> > --- > 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 > >
On Wed, Mar 27, 2024 at 12:56 PM Christian Göttsche <cgzones@googlemail.com> wrote: > On Wed, 27 Mar 2024 at 16:52, Paul Moore <paul@paul-moore.com> 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@canb.auug.org.au> > > Signed-off-by: Paul Moore <paul@paul-moore.com> > > --- > > 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? Agreed, that would be better. Did you want to submit a patch with this? I can always update my patch, but it's always nice when the original patch author fixes the problems in their patch. The catch is that you would need to submit the patch soon. > `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
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); goto bad; }
Correct the use of integer specifiers when printing ebitmap and ebitmap_node information. Fixes: 0142c56682fb ("selinux: reject invalid ebitmaps") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Moore <paul@paul-moore.com> --- security/selinux/ss/ebitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)