diff mbox series

[v2] selinux: fix wrong buffer types in policydb.c

Message ID 20200116184557.344610-1-omosnace@redhat.com (mailing list archive)
State Accepted
Headers show
Series [v2] selinux: fix wrong buffer types in policydb.c | expand

Commit Message

Ondrej Mosnacek Jan. 16, 2020, 6:45 p.m. UTC
Two places used u32 where there should have been __le32.

Fixes sparse warnings:
  CHECK   [...]/security/selinux/ss/services.c
[...]/security/selinux/ss/policydb.c:2669:16: warning: incorrect type in assignment (different base types)
[...]/security/selinux/ss/policydb.c:2669:16:    expected unsigned int
[...]/security/selinux/ss/policydb.c:2669:16:    got restricted __le32 [usertype]
[...]/security/selinux/ss/policydb.c:2674:24: warning: incorrect type in assignment (different base types)
[...]/security/selinux/ss/policydb.c:2674:24:    expected unsigned int
[...]/security/selinux/ss/policydb.c:2674:24:    got restricted __le32 [usertype]
[...]/security/selinux/ss/policydb.c:2675:24: warning: incorrect type in assignment (different base types)
[...]/security/selinux/ss/policydb.c:2675:24:    expected unsigned int
[...]/security/selinux/ss/policydb.c:2675:24:    got restricted __le32 [usertype]
[...]/security/selinux/ss/policydb.c:2676:24: warning: incorrect type in assignment (different base types)
[...]/security/selinux/ss/policydb.c:2676:24:    expected unsigned int
[...]/security/selinux/ss/policydb.c:2676:24:    got restricted __le32 [usertype]
[...]/security/selinux/ss/policydb.c:2681:32: warning: incorrect type in assignment (different base types)
[...]/security/selinux/ss/policydb.c:2681:32:    expected unsigned int
[...]/security/selinux/ss/policydb.c:2681:32:    got restricted __le32 [usertype]
[...]/security/selinux/ss/policydb.c:2701:16: warning: incorrect type in assignment (different base types)
[...]/security/selinux/ss/policydb.c:2701:16:    expected unsigned int
[...]/security/selinux/ss/policydb.c:2701:16:    got restricted __le32 [usertype]
[...]/security/selinux/ss/policydb.c:2706:24: warning: incorrect type in assignment (different base types)
[...]/security/selinux/ss/policydb.c:2706:24:    expected unsigned int
[...]/security/selinux/ss/policydb.c:2706:24:    got restricted __le32 [usertype]
[...]/security/selinux/ss/policydb.c:2707:24: warning: incorrect type in assignment (different base types)
[...]/security/selinux/ss/policydb.c:2707:24:    expected unsigned int
[...]/security/selinux/ss/policydb.c:2707:24:    got restricted __le32 [usertype]

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Reviewed-by: Stephen Smalley <sds@tycho.nsa.gov>
---
 security/selinux/ss/policydb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paul Moore Jan. 16, 2020, 7:33 p.m. UTC | #1
On Thu, Jan 16, 2020 at 1:46 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> Two places used u32 where there should have been __le32.
>
> Fixes sparse warnings:
>   CHECK   [...]/security/selinux/ss/services.c
> [...]/security/selinux/ss/policydb.c:2669:16: warning: incorrect type in assignment (different base types)
> [...]/security/selinux/ss/policydb.c:2669:16:    expected unsigned int
> [...]/security/selinux/ss/policydb.c:2669:16:    got restricted __le32 [usertype]
> [...]/security/selinux/ss/policydb.c:2674:24: warning: incorrect type in assignment (different base types)
> [...]/security/selinux/ss/policydb.c:2674:24:    expected unsigned int
> [...]/security/selinux/ss/policydb.c:2674:24:    got restricted __le32 [usertype]
> [...]/security/selinux/ss/policydb.c:2675:24: warning: incorrect type in assignment (different base types)
> [...]/security/selinux/ss/policydb.c:2675:24:    expected unsigned int
> [...]/security/selinux/ss/policydb.c:2675:24:    got restricted __le32 [usertype]
> [...]/security/selinux/ss/policydb.c:2676:24: warning: incorrect type in assignment (different base types)
> [...]/security/selinux/ss/policydb.c:2676:24:    expected unsigned int
> [...]/security/selinux/ss/policydb.c:2676:24:    got restricted __le32 [usertype]
> [...]/security/selinux/ss/policydb.c:2681:32: warning: incorrect type in assignment (different base types)
> [...]/security/selinux/ss/policydb.c:2681:32:    expected unsigned int
> [...]/security/selinux/ss/policydb.c:2681:32:    got restricted __le32 [usertype]
> [...]/security/selinux/ss/policydb.c:2701:16: warning: incorrect type in assignment (different base types)
> [...]/security/selinux/ss/policydb.c:2701:16:    expected unsigned int
> [...]/security/selinux/ss/policydb.c:2701:16:    got restricted __le32 [usertype]
> [...]/security/selinux/ss/policydb.c:2706:24: warning: incorrect type in assignment (different base types)
> [...]/security/selinux/ss/policydb.c:2706:24:    expected unsigned int
> [...]/security/selinux/ss/policydb.c:2706:24:    got restricted __le32 [usertype]
> [...]/security/selinux/ss/policydb.c:2707:24: warning: incorrect type in assignment (different base types)
> [...]/security/selinux/ss/policydb.c:2707:24:    expected unsigned int
> [...]/security/selinux/ss/policydb.c:2707:24:    got restricted __le32 [usertype]
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> Reviewed-by: Stephen Smalley <sds@tycho.nsa.gov>
> ---
>  security/selinux/ss/policydb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Merged into selinux/next, thanks!
diff mbox series

Patch

diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index e369b0092cdf..2aa7f2e1a8e7 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -2659,7 +2659,7 @@  static int role_trans_write(struct policydb *p, void *fp)
 {
 	struct role_trans *r = p->role_tr;
 	struct role_trans *tr;
-	u32 buf[3];
+	__le32 buf[3];
 	size_t nel;
 	int rc;
 
@@ -2691,7 +2691,7 @@  static int role_trans_write(struct policydb *p, void *fp)
 static int role_allow_write(struct role_allow *r, void *fp)
 {
 	struct role_allow *ra;
-	u32 buf[2];
+	__le32 buf[2];
 	size_t nel;
 	int rc;