Commit 8ba1d537 authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Paul Moore

selinux: provide __le variables explicitly

While the endiannes is being handled properly sparse was unable to verify
this due to type inconsistency. So introduce an additional __le32
respectively _le64 variable to be passed to le32/64_to_cpu() to allow
sparse to verify proper typing. Note that this patch does not change
the generated binary on little-endian systems - on 32bit powerpc it
does change the binary.
Signed-off-by: default avatarNicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent a188339c
...@@ -347,7 +347,9 @@ int ebitmap_read(struct ebitmap *e, void *fp) ...@@ -347,7 +347,9 @@ int ebitmap_read(struct ebitmap *e, void *fp)
{ {
struct ebitmap_node *n = NULL; struct ebitmap_node *n = NULL;
u32 mapunit, count, startbit, index; u32 mapunit, count, startbit, index;
__le32 ebitmap_start;
u64 map; u64 map;
__le64 mapbits;
__le32 buf[3]; __le32 buf[3];
int rc, i; int rc, i;
...@@ -381,12 +383,12 @@ int ebitmap_read(struct ebitmap *e, void *fp) ...@@ -381,12 +383,12 @@ int ebitmap_read(struct ebitmap *e, void *fp)
goto bad; goto bad;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
rc = next_entry(&startbit, fp, sizeof(u32)); rc = next_entry(&ebitmap_start, fp, sizeof(u32));
if (rc < 0) { if (rc < 0) {
pr_err("SELinux: ebitmap: truncated map\n"); pr_err("SELinux: ebitmap: truncated map\n");
goto bad; goto bad;
} }
startbit = le32_to_cpu(startbit); startbit = le32_to_cpu(ebitmap_start);
if (startbit & (mapunit - 1)) { if (startbit & (mapunit - 1)) {
pr_err("SELinux: ebitmap start bit (%d) is " pr_err("SELinux: ebitmap start bit (%d) is "
...@@ -423,12 +425,12 @@ int ebitmap_read(struct ebitmap *e, void *fp) ...@@ -423,12 +425,12 @@ int ebitmap_read(struct ebitmap *e, void *fp)
goto bad; goto bad;
} }
rc = next_entry(&map, fp, sizeof(u64)); rc = next_entry(&mapbits, fp, sizeof(u64));
if (rc < 0) { if (rc < 0) {
pr_err("SELinux: ebitmap: truncated map\n"); pr_err("SELinux: ebitmap: truncated map\n");
goto bad; goto bad;
} }
map = le64_to_cpu(map); map = le64_to_cpu(mapbits);
index = (startbit - n->startbit) / EBITMAP_UNIT_SIZE; index = (startbit - n->startbit) / EBITMAP_UNIT_SIZE;
while (map) { while (map) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment