Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
e6e8bf41
Commit
e6e8bf41
authored
Jan 16, 2017
by
John Johansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apparmor: fix restricted endian type warnings for dfa unpack
Signed-off-by:
John Johansen
<
john.johansen@canonical.com
>
parent
ca4bd5ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
security/apparmor/include/match.h
security/apparmor/include/match.h
+3
-3
security/apparmor/match.c
security/apparmor/match.c
+9
-9
No files found.
security/apparmor/include/match.h
View file @
e6e8bf41
...
...
@@ -104,11 +104,11 @@ extern struct aa_dfa *nulldfa;
#define byte_to_byte(X) (X)
#define UNPACK_ARRAY(TABLE, BLOB, LEN, T
YPE, NTOHX)
\
#define UNPACK_ARRAY(TABLE, BLOB, LEN, T
TYPE, BTYPE, NTOHX)
\
do { \
typeof(LEN) __i; \
T
YPE *__t = (
TYPE *) TABLE; \
TYPE *__b = (
TYPE *) BLOB; \
T
TYPE *__t = (T
TYPE *) TABLE; \
BTYPE *__b = (B
TYPE *) BLOB; \
for (__i = 0; __i < LEN; __i++) { \
__t[__i] = NTOHX(__b[__i]); \
} \
...
...
security/apparmor/match.c
View file @
e6e8bf41
...
...
@@ -73,11 +73,11 @@ static struct table_header *unpack_table(char *blob, size_t bsize)
/* loaded td_id's start at 1, subtract 1 now to avoid doing
* it every time we use td_id as an index
*/
th
.
td_id
=
be16_to_cpu
(
*
(
u
16
*
)
(
blob
))
-
1
;
th
.
td_id
=
be16_to_cpu
(
*
(
__be
16
*
)
(
blob
))
-
1
;
if
(
th
.
td_id
>
YYTD_ID_MAX
)
goto
out
;
th
.
td_flags
=
be16_to_cpu
(
*
(
u
16
*
)
(
blob
+
2
));
th
.
td_lolen
=
be32_to_cpu
(
*
(
u
32
*
)
(
blob
+
8
));
th
.
td_flags
=
be16_to_cpu
(
*
(
__be
16
*
)
(
blob
+
2
));
th
.
td_lolen
=
be32_to_cpu
(
*
(
__be
32
*
)
(
blob
+
8
));
blob
+=
sizeof
(
struct
table_header
);
if
(
!
(
th
.
td_flags
==
YYTD_DATA16
||
th
.
td_flags
==
YYTD_DATA32
||
...
...
@@ -95,13 +95,13 @@ static struct table_header *unpack_table(char *blob, size_t bsize)
table
->
td_lolen
=
th
.
td_lolen
;
if
(
th
.
td_flags
==
YYTD_DATA8
)
UNPACK_ARRAY
(
table
->
td_data
,
blob
,
th
.
td_lolen
,
u8
,
byte_to_byte
);
u8
,
u8
,
byte_to_byte
);
else
if
(
th
.
td_flags
==
YYTD_DATA16
)
UNPACK_ARRAY
(
table
->
td_data
,
blob
,
th
.
td_lolen
,
u16
,
be16_to_cpu
);
u16
,
__be16
,
be16_to_cpu
);
else
if
(
th
.
td_flags
==
YYTD_DATA32
)
UNPACK_ARRAY
(
table
->
td_data
,
blob
,
th
.
td_lolen
,
u32
,
be32_to_cpu
);
u32
,
__be32
,
be32_to_cpu
);
else
goto
fail
;
/* if table was vmalloced make sure the page tables are synced
...
...
@@ -249,14 +249,14 @@ struct aa_dfa *aa_dfa_unpack(void *blob, size_t size, int flags)
if
(
size
<
sizeof
(
struct
table_set_header
))
goto
fail
;
if
(
ntohl
(
*
(
u
32
*
)
data
)
!=
YYTH_MAGIC
)
if
(
ntohl
(
*
(
__be
32
*
)
data
)
!=
YYTH_MAGIC
)
goto
fail
;
hsize
=
ntohl
(
*
(
u
32
*
)
(
data
+
4
));
hsize
=
ntohl
(
*
(
__be
32
*
)
(
data
+
4
));
if
(
size
<
hsize
)
goto
fail
;
dfa
->
flags
=
ntohs
(
*
(
u
16
*
)
(
data
+
12
));
dfa
->
flags
=
ntohs
(
*
(
__be
16
*
)
(
data
+
12
));
data
+=
hsize
;
size
-=
hsize
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment