[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] linux-user: add do_setsockopt CAN_RAW_FD_FRAMES support
From: |
Laurent Vivier |
Subject: |
Re: [PATCH 2/2] linux-user: add do_setsockopt CAN_RAW_FD_FRAMES support |
Date: |
Tue, 12 May 2020 22:20:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
Le 06/05/2020 à 15:21, Tomas Krcka a écrit :
> Signed-off-by: Tomas Krcka <address@hidden>
> ---
> linux-user/syscall.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 88d4c85b70..f751ed8b37 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -2141,6 +2141,19 @@ static abi_long do_setsockopt(int sockfd, int level,
> int optname,
> g_free(can_filters);
> break;
> }
> + case CAN_RAW_FD_FRAMES:
> + {
> + val = 0;
You don't need to set val to 0.
> + if (optlen < sizeof(uint32_t)) {
kernel checks for the exact size and fails otherwise.
> + return -TARGET_EINVAL;
> + }
> + if (get_user_u32(val, optval_addr)) {
> + return -TARGET_EFAULT;
> + }
> + ret = get_errno(setsockopt(sockfd, level, optname,
> + &val, sizeof(val)));
> + break;
> + }
> default:
> goto unimplemented;
> }
>
Could you implement getsockopt() too?
Thanks,
Laurent