From: Laurent Vivier <laurent@vivier.eu>
To: Josh Kunz <jkz@google.com>, qemu-devel@nongnu.org
Cc: riku.voipio@iki.fi
Subject: Re: [PATCH] linux-user: Support for NETLINK socket options
Date: Sat, 2 Nov 2019 10:30:13 +0100 [thread overview]
Message-ID: <7e707755-4a3c-d573-6dc4-81b5c2ad4e56@vivier.eu> (raw)
In-Reply-To: <20191029224310.164025-1-jkz@google.com>
Le 29/10/2019 à 23:43, Josh Kunz a écrit :
> This change includes support for all AF_NETLINK socket options up to about
> kernel version 5.4 (5.4 is not formally released at the time of writing).
> Socket options that were introduced in kernel versions before the oldest
> currently stable kernel version are guarded by kernel version macros.
>
> This change has been built under gcc 8.3, and clang 9.0, and it passes
> `make check`. The netlink options have been tested by emulating some
> non-trival software that uses NETLINK socket options, but they have
> not been exaustively verified.
>
> Signed-off-by: Josh Kunz <jkz@google.com>
> ---
> linux-user/syscall.c | 98 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 98 insertions(+)
...
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
> + case NETLINK_LIST_MEMBERSHIPS:
> + {
> + if (get_user_u32(len, optlen)) {
> + return -TARGET_EFAULT;
> + }
> + if (len < 0) {
> + return -TARGET_EINVAL;
> + }
> + uint32_t *results = lock_user(VERIFY_WRITE, optval_addr, len, 1);
Please put the declaration of "results" at the beginning of the block.
See CODING_STYLE file, "Declarations"
> + if (!results) {
> + return -TARGET_EFAULT;
> + }
> + lv = len;
> + ret = get_errno(getsockopt(sockfd, level, optname, results, &lv));
> + if (ret < 0) {
> + unlock_user(results, optval_addr, 0);
> + return ret;
> + }
> + /* swap host endianess to target endianess. */
> + for (int i = 0; i < (len / sizeof(uint32_t)); i++) {
Put the declaration of "i" at the beginning of the block.
Otherwise, it looks good.
Thanks,
Laurent
next prev parent reply other threads:[~2019-11-02 9:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-29 22:43 [PATCH] linux-user: Support for NETLINK socket options Josh Kunz
2019-11-02 9:30 ` Laurent Vivier [this message]
2019-11-05 9:25 ` Laurent Vivier
2019-11-05 18:21 ` Josh Kunz
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=7e707755-4a3c-d573-6dc4-81b5c2ad4e56@vivier.eu \
--to=laurent@vivier.eu \
--cc=jkz@google.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).