netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	Michal Kubecek <mkubecek@suse.cz>, Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] ethtool: improve compat ioctl handling
Date: Sat, 19 Sep 2020 06:43:33 +0100	[thread overview]
Message-ID: <20200919054333.GM30063@infradead.org> (raw)
In-Reply-To: <20200918120536.1464804-1-arnd@arndb.de>

> +	if (ethtool_translate_compat()) {
> +		struct compat_ethtool_rxnfc crxnfc = {};
> +
> +		if (copy_from_user(&crxnfc, useraddr,
> +				   min(size, sizeof(crxnfc))))
> +			return -EFAULT;
> +
> +		*rxnfc = (struct ethtool_rxnfc) {
> +			.cmd		= crxnfc.cmd,
> +			.flow_type	= crxnfc.flow_type,
> +			.data		= crxnfc.data,
> +			.fs		= {
> +				.flow_type	= crxnfc.fs.flow_type,
> +				.h_u		= crxnfc.fs.h_u,
> +				.h_ext		= crxnfc.fs.h_ext,
> +				.m_u		= crxnfc.fs.m_u,
> +				.m_ext		= crxnfc.fs.m_ext,
> +				.ring_cookie	= crxnfc.fs.ring_cookie,
> +				.location	= crxnfc.fs.location,
> +			},
> +			.rule_cnt	= crxnfc.rule_cnt,
> +		};

I'd split the compat version into a self-contained noinline helper.
Same for ethtool_rxnfc_copy_to_user.

Otherwise this looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

  parent reply	other threads:[~2020-09-19  5:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 12:05 [PATCH 1/2] ethtool: improve compat ioctl handling Arnd Bergmann
2020-09-18 12:05 ` [PATCH 2/2] dev_ioctl: split out SIOC?IFMAP ioctls Arnd Bergmann
2020-09-19  5:48   ` Christoph Hellwig
2020-09-25 12:28     ` Arnd Bergmann
2020-09-29 17:52       ` Christoph Hellwig
2020-10-01 15:00         ` Arnd Bergmann
2020-09-19  5:43 ` Christoph Hellwig [this message]
2020-09-19 23:40 ` [PATCH 1/2] ethtool: improve compat ioctl handling David Miller

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=20200919054333.GM30063@infradead.org \
    --to=hch@infradead.org \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=gustavo@embeddedor.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    /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).