aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorChen Gang <gang.chen@asianux.com>2013-04-07 04:55:23 -0400
committerEric Paris <eparis@redhat.com>2013-04-10 13:31:12 -0400
commit2950fa9d3291b90e9b7663b6a409ea37a97a5e35 (patch)
tree59d613c0734447257a48974d81035538e8397b48 /net/socket.c
parent65ada7bc02e2dcea6dea1f11876e712d5ea7e9ba (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 'net/socket.c')
-rw-r--r--net/socket.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/socket.c b/net/socket.c
index 2ca51c719ef9..1bbc37b7a312 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2436,7 +2436,7 @@ static const unsigned char nargs[21] = {
2436 2436
2437SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) 2437SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
2438{ 2438{
2439 unsigned long a[6]; 2439 unsigned long a[AUDITSC_ARGS];
2440 unsigned long a0, a1; 2440 unsigned long a0, a1;
2441 int err; 2441 int err;
2442 unsigned int len; 2442 unsigned int len;
@@ -2452,7 +2452,9 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
2452 if (copy_from_user(a, args, len)) 2452 if (copy_from_user(a, args, len))
2453 return -EFAULT; 2453 return -EFAULT;
2454 2454
2455 audit_socketcall(nargs[call] / sizeof(unsigned long), a); 2455 err = audit_socketcall(nargs[call] / sizeof(unsigned long), a);
2456 if (err)
2457 return err;
2456 2458
2457 a0 = a[0]; 2459 a0 = a[0];
2458 a1 = a[1]; 2460 a1 = a[1];