net/compat: convert to COMPAT_SYSCALL_DEFINE
Convert all compat system call functions where all parameter types have a size of four or less than four bytes, or are pointer types to COMPAT_SYSCALL_DEFINE. The implicit casts within COMPAT_SYSCALL_DEFINE will perform proper zero and sign extension to 64 bit of all parameters if needed. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
This commit is contained in:
Родитель
62a6fa9768
Коммит
361d93c46f
24
net/compat.c
24
net/compat.c
|
@ -384,8 +384,8 @@ static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
|
||||||
return sock_setsockopt(sock, level, optname, optval, optlen);
|
return sock_setsockopt(sock, level, optname, optval, optlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
|
COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
|
||||||
char __user *optval, unsigned int optlen)
|
char __user *, optval, unsigned int, optlen)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct socket *sock = sockfd_lookup(fd, &err);
|
struct socket *sock = sockfd_lookup(fd, &err);
|
||||||
|
@ -504,8 +504,8 @@ int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *usersta
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(compat_sock_get_timestampns);
|
EXPORT_SYMBOL(compat_sock_get_timestampns);
|
||||||
|
|
||||||
asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
|
COMPAT_SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
|
||||||
char __user *optval, int __user *optlen)
|
char __user *, optval, int __user *, optlen)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct socket *sock = sockfd_lookup(fd, &err);
|
struct socket *sock = sockfd_lookup(fd, &err);
|
||||||
|
@ -735,15 +735,15 @@ static unsigned char nas[21] = {
|
||||||
};
|
};
|
||||||
#undef AL
|
#undef AL
|
||||||
|
|
||||||
asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags)
|
COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags)
|
||||||
{
|
{
|
||||||
if (flags & MSG_CMSG_COMPAT)
|
if (flags & MSG_CMSG_COMPAT)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
|
return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
|
COMPAT_SYSCALL_DEFINE4(sendmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
|
||||||
unsigned int vlen, unsigned int flags)
|
unsigned int, vlen, unsigned int, flags)
|
||||||
{
|
{
|
||||||
if (flags & MSG_CMSG_COMPAT)
|
if (flags & MSG_CMSG_COMPAT)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -751,7 +751,7 @@ asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
|
||||||
flags | MSG_CMSG_COMPAT);
|
flags | MSG_CMSG_COMPAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags)
|
COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags)
|
||||||
{
|
{
|
||||||
if (flags & MSG_CMSG_COMPAT)
|
if (flags & MSG_CMSG_COMPAT)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -770,9 +770,9 @@ asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len,
|
||||||
return sys_recvfrom(fd, buf, len, flags | MSG_CMSG_COMPAT, addr, addrlen);
|
return sys_recvfrom(fd, buf, len, flags | MSG_CMSG_COMPAT, addr, addrlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
|
COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
|
||||||
unsigned int vlen, unsigned int flags,
|
unsigned int, vlen, unsigned int, flags,
|
||||||
struct compat_timespec __user *timeout)
|
struct compat_timespec __user *, timeout)
|
||||||
{
|
{
|
||||||
int datagrams;
|
int datagrams;
|
||||||
struct timespec ktspec;
|
struct timespec ktspec;
|
||||||
|
@ -795,7 +795,7 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
|
||||||
return datagrams;
|
return datagrams;
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
|
COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
u32 a[6];
|
u32 a[6];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче