All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Florian Westphal <fw@strlen.de>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v2 3/5] mptcp: add MPTCP_TCPINFO getsockopt support
Date: Tue, 17 Aug 2021 17:54:34 -0700 (PDT)	[thread overview]
Message-ID: <8b5d6f4e-5e8d-6b1-38de-8faa5ce9c3fc@linux.intel.com> (raw)
In-Reply-To: <20210816162636.25611-4-fw@strlen.de>


On Mon, 16 Aug 2021, Florian Westphal wrote:

> diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
> index f7683c22911f..77838933760c 100644
> --- a/net/mptcp/sockopt.c
> +++ b/net/mptcp/sockopt.c

...

> @@ -727,6 +729,117 @@ static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, in
> 	return 0;
> }
>
> +static int mptcp_put_subflow_data(struct mptcp_subflow_data *sfd,
> +				  char __user *optval,
> +				  u32 copied,
> +				  int __user *optlen)
> +{
> +	u32 copylen = min_t(u32, sfd->size_subflow_data, sizeof(*sfd));
> +
> +	if (copied)
> +		copied += sfd->size_subflow_data;
> +	else
> +		copied = copylen;
> +
> +	if (put_user(copied, optlen))
> +		return -EFAULT;
> +
> +	if (copy_to_user(optval, sfd, copylen))
> +		return -EFAULT;
> +
> +	return 0;
> +}
> +
> +static int mptcp_get_subflow_data(struct mptcp_subflow_data *sfd,
> +				  char __user *optval, int __user *optlen)
> +{
> +	int len, copylen;
> +
> +	if (get_user(len, optlen))
> +		return -EFAULT;
> +
> +	/* if mptcp_subflow_data size is changed, need to adjust
> +	 * this function to deal with programs using old version.
> +	 */
> +	BUILD_BUG_ON(MIN_INFO_OPTLEN_SIZE != sizeof(*sfd));

checkpatch complains that the constant should be on the right.


--
Mat Martineau
Intel

  reply	other threads:[~2021-08-18  0:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 16:26 [PATCH mptcp-next v2 0/5] mptcp: add SOL_MPTCP getsockopt support Florian Westphal
2021-08-16 16:26 ` [PATCH mptcp-next v2 1/5] mptcp: add new mptcp_fill_diag helper Florian Westphal
2021-08-16 16:26 ` [PATCH mptcp-next v2 2/5] mptcp: add MPTCP_INFO getsockopt Florian Westphal
2021-08-16 16:26 ` [PATCH mptcp-next v2 3/5] mptcp: add MPTCP_TCPINFO getsockopt support Florian Westphal
2021-08-18  0:54   ` Mat Martineau [this message]
2021-08-16 16:26 ` [PATCH mptcp-next v2 4/5] mptcp: add MPTCP_SUBFLOW_ADDRS " Florian Westphal
2021-08-18  0:31   ` Mat Martineau
2021-08-16 16:26 ` [PATCH mptcp-next v2 5/5] selftests: mptcp: add mptcp getsockopt test cases Florian Westphal
2021-08-17  2:17   ` kernel test robot
2021-08-17  2:17     ` kernel test robot
2021-08-18  0:51   ` Mat Martineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b5d6f4e-5e8d-6b1-38de-8faa5ce9c3fc@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=fw@strlen.de \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.