diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-04-07 04:55:23 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2013-04-10 13:31:12 -0400 |
commit | 2950fa9d3291b90e9b7663b6a409ea37a97a5e35 (patch) | |
tree | 59d613c0734447257a48974d81035538e8397b48 /include | |
parent | 65ada7bc02e2dcea6dea1f11876e712d5ea7e9ba (diff) |
kernel: audit: beautify code, for extern function, better to check its parameters by itself
__audit_socketcall is an extern function.
better to check its parameters by itself.
also can return error code, when fail (find invalid parameters).
also use macro instead of real hard code number
also give related comments for it.
Signed-off-by: Chen Gang <gang.chen@asianux.com>
[eparis: fix the return value when !CONFIG_AUDIT]
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/audit.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 37464c592c92..8f92e1dea966 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -84,6 +84,9 @@ extern int audit_classify_arch(int arch); | |||
84 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ | 84 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ |
85 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ | 85 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ |
86 | 86 | ||
87 | /* maximized args number that audit_socketcall can process */ | ||
88 | #define AUDITSC_ARGS 6 | ||
89 | |||
87 | struct filename; | 90 | struct filename; |
88 | 91 | ||
89 | #ifdef CONFIG_AUDITSYSCALL | 92 | #ifdef CONFIG_AUDITSYSCALL |
@@ -190,7 +193,7 @@ extern void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk | |||
190 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); | 193 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); |
191 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); | 194 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); |
192 | extern int __audit_bprm(struct linux_binprm *bprm); | 195 | extern int __audit_bprm(struct linux_binprm *bprm); |
193 | extern void __audit_socketcall(int nargs, unsigned long *args); | 196 | extern int __audit_socketcall(int nargs, unsigned long *args); |
194 | extern int __audit_sockaddr(int len, void *addr); | 197 | extern int __audit_sockaddr(int len, void *addr); |
195 | extern void __audit_fd_pair(int fd1, int fd2); | 198 | extern void __audit_fd_pair(int fd1, int fd2); |
196 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); | 199 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); |
@@ -224,10 +227,11 @@ static inline int audit_bprm(struct linux_binprm *bprm) | |||
224 | return __audit_bprm(bprm); | 227 | return __audit_bprm(bprm); |
225 | return 0; | 228 | return 0; |
226 | } | 229 | } |
227 | static inline void audit_socketcall(int nargs, unsigned long *args) | 230 | static inline int audit_socketcall(int nargs, unsigned long *args) |
228 | { | 231 | { |
229 | if (unlikely(!audit_dummy_context())) | 232 | if (unlikely(!audit_dummy_context())) |
230 | __audit_socketcall(nargs, args); | 233 | return __audit_socketcall(nargs, args); |
234 | return 0; | ||
231 | } | 235 | } |
232 | static inline int audit_sockaddr(int len, void *addr) | 236 | static inline int audit_sockaddr(int len, void *addr) |
233 | { | 237 | { |
@@ -354,8 +358,10 @@ static inline int audit_bprm(struct linux_binprm *bprm) | |||
354 | { | 358 | { |
355 | return 0; | 359 | return 0; |
356 | } | 360 | } |
357 | static inline void audit_socketcall(int nargs, unsigned long *args) | 361 | static inline int audit_socketcall(int nargs, unsigned long *args) |
358 | { } | 362 | { |
363 | return 0; | ||
364 | } | ||
359 | static inline void audit_fd_pair(int fd1, int fd2) | 365 | static inline void audit_fd_pair(int fd1, int fd2) |
360 | { } | 366 | { } |
361 | static inline int audit_sockaddr(int len, void *addr) | 367 | static inline int audit_sockaddr(int len, void *addr) |