public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kubakici@wp.pl>
To: Tariq Toukan <tariqt@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Eran Ben Elisha <eranbe@mellanox.com>,
	Eugenia Emantayev <eugenia@mellanox.com>
Subject: Re: [PATCH net-next 1/3] ethtool: Ensure new ring parameters are within bounds during SRINGPARAM
Date: Mon, 8 Jan 2018 23:35:47 -0800	[thread overview]
Message-ID: <20180108233547.40035769@laptop> (raw)
In-Reply-To: <d87fd32a-474f-fccf-fecc-29301e592869@mellanox.com>

On Tue, 9 Jan 2018 09:30:05 +0200
Tariq Toukan <tariqt@mellanox.com> wrote:
> >> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> >> index 50a79203043b..9ea7cd52fde0 100644
> >> --- a/net/core/ethtool.c
> >> +++ b/net/core/ethtool.c
> >> @@ -1704,14 +1704,23 @@ static int ethtool_get_ringparam(struct
> >> net_device *dev, void __user *useraddr) 
> >>   static int ethtool_set_ringparam(struct net_device *dev, void
> >> __user *useraddr) {
> >> -	struct ethtool_ringparam ringparam;
> >> +	struct ethtool_ringparam ringparam, max = { .cmd =
> >> ETHTOOL_GRINGPARAM }; 
> >> -	if (!dev->ethtool_ops->set_ringparam)
> >> +	if (!dev->ethtool_ops->set_ringparam
> >> || !dev->ethtool_ops->get_ringparam) return -EOPNOTSUPP;
> >>   
> >>   	if (copy_from_user(&ringparam, useraddr,
> >> sizeof(ringparam))) return -EFAULT;
> >>   
> >> +	dev->ethtool_ops->get_ringparam(dev, &max);  
> > 
> > Perhaps check the return value here?  It's pretty unlikely but
> > get_ringparam may fail.
> >   
> 
> get_ringparam NDO returns void.

Ah, you're right, I looked at the return of ethtool_get_ringparam().

  reply	other threads:[~2018-01-09  7:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 14:00 [PATCH net-next 0/3] ethtool ringparam upper bound Tariq Toukan
2018-01-08 14:00 ` [PATCH net-next 1/3] ethtool: Ensure new ring parameters are within bounds during SRINGPARAM Tariq Toukan
2018-01-09  2:23   ` Jakub Kicinski
2018-01-09  7:30     ` Tariq Toukan
2018-01-09  7:35       ` Jakub Kicinski [this message]
2018-01-08 14:00 ` [PATCH net-next 2/3] net/mlx4_en: Align behavior of set ring size flow via ethtool Tariq Toukan
2018-01-08 14:00 ` [PATCH net-next 3/3] net/mlx5e: Remove redundant checks in set_ringparam Tariq Toukan
2018-01-09 16:55 ` [PATCH net-next 0/3] ethtool ringparam upper bound 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=20180108233547.40035769@laptop \
    --to=kubakici@wp.pl \
    --cc=davem@davemloft.net \
    --cc=eranbe@mellanox.com \
    --cc=eugenia@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=tariqt@mellanox.com \
    /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