On Fri, Jun 21, 2019 at 03:30:20PM -0700, Shannon Nelson wrote:
> On 6/20/19 7:32 PM, Michal Kubecek wrote:
> > On Thu, Jun 20, 2019 at 01:24:19PM -0700, Shannon Nelson wrote:
> > > + if (ring->tx_pending > IONIC_MAX_TXRX_DESC ||
> > > +     ring->tx_pending < IONIC_MIN_TXRX_DESC ||
> > > +     ring->rx_pending > IONIC_MAX_TXRX_DESC ||
> > > +     ring->rx_pending < IONIC_MIN_TXRX_DESC) {
> > > +         netdev_info(netdev, "Descriptors count must be in the range 
> > > [%d-%d]\n",
> > > +                     IONIC_MIN_TXRX_DESC, IONIC_MAX_TXRX_DESC);
> > > +         return -EINVAL;
> > > + }
> > The upper bounds have been already checked in ethtool_set_ringparam() so
> > that the two conditions can never be satisfied here.
> > 
> > ...
> > > +static int ionic_set_channels(struct net_device *netdev,
> > > +                       struct ethtool_channels *ch)
> > > +{
> > > + struct lif *lif = netdev_priv(netdev);
> > > + bool running;
> > > +
> > > + if (!ch->combined_count || ch->other_count ||
> > > +     ch->rx_count || ch->tx_count)
> > > +         return -EINVAL;
> > > +
> > > + if (ch->combined_count > lif->ionic->ntxqs_per_lif)
> > > +         return -EINVAL;
> > This has been already checked in ethtool_set_channels().
> 
> That's what I get for copying from an existing driver.  I'll check those and
> clean them up.

The checks in general code were only added recently so most drivers
probably still have their own checks.

Michal Kubecek

Reply via email to