[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211206171405.13e9f9ee@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Mon, 6 Dec 2021 17:14:05 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Mat Martineau <mathew.j.martineau@...ux.intel.com>
Cc: netdev@...r.kernel.org, Florian Westphal <fw@...len.de>,
davem@...emloft.net, matthieu.baerts@...sares.net,
mptcp@...ts.linux.dev
Subject: Re: [PATCH net-next 01/10] mptcp: add TCP_INQ cmsg support
On Fri, 3 Dec 2021 14:35:32 -0800 Mat Martineau wrote:
> +static int mptcp_put_int_option(struct mptcp_sock *msk, char __user *optval,
> + int __user *optlen, int val)
> +{
> + int len;
> +
> + if (get_user(len, optlen))
> + return -EFAULT;
> +
> + len = min_t(unsigned int, len, sizeof(int));
> + if (len < 0)
> + return -EINVAL;
TCP has the same statement but surely it's dead code?
min_t(unsigned, .., 4)
cannot return anything outside of the range from 0 to 4.
> + if (put_user(len, optlen))
> + return -EFAULT;
> + if (copy_to_user(optval, &val, len))
> + return -EFAULT;
> +
> + return 0;
Powered by blists - more mailing lists