lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1308855335.2712.15.camel@bwh-desktop>
Date:	Thu, 23 Jun 2011 19:55:35 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Mahesh Bandewar <maheshb@...gle.com>
Cc:	Michał Mirosław <mirq-linux@...e.qmqm.pl>,
	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>
Subject: Re: [RFT PATCH 7/9] ethtool: prepare for larger netdev_features_t
 type

On Thu, 2011-06-23 at 11:21 -0700, Mahesh Bandewar wrote:
> On Thu, Jun 23, 2011 at 11:03 AM, Ben Hutchings
> <bhutchings@...arflare.com> wrote:
> > On Thu, 2011-06-23 at 10:50 -0700, Mahesh Bandewar wrote:
> >> On Mon, Jun 20, 2011 at 2:16 PM, Ben Hutchings
> >> <bhutchings@...arflare.com> wrote:
> >> >
> >> > On Mon, 2011-06-20 at 21:14 +0200, Michał Mirosław wrote:
> >> > [...]
> >> > > @@ -125,19 +131,26 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
> >> > >       if (copy_from_user(features, useraddr, sizeof(features)))
> >> > >               return -EFAULT;
> >> > >
> >> > > -     if (features[0].valid & ~NETIF_F_ETHTOOL_BITS)
> >> > > +     /* I wonder if the compiler will be smart enough to loop-unroll
> >> > > +      * and optimize this... (no worries if not) --mq */
> >> > > +     for (i = ETHTOOL_DEV_FEATURE_WORDS; i-- > 0; ) {
> >> > > +             valid = (valid << 32)|features[i].valid;
> >> > > +             wanted = (wanted << 32)|features[i].requested;
> >> > > +     }
> >> > [...]
> >> >
> >> > I don't know (or care) about optimisation of this, but I would expect
> >> > gcc to complain about shifting a 32-bit value by 32 bits.  I suggest you
> >> > write this as:
> >> >
> >> >        for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
> >> >                valid |= (netdev_features_t)features[i].valid << 32 *i;
> >> >                wanted |= (netdev_features_t)features[i].requested << 32 *i;
> >>
> >> It's a valid point but this type of typecast or similar usage would
> >> imply that netdev_feature_t is an int of XXX bits. That's not opaque
> >> and would hinder the way you can abstract the feature type.
> >
> > Yes, ethtool_{get,set}_features() will have to be changed if and when
> > the representation of netdev_features_t is changed significantly.  I
> > don't think there's any way of avoiding that and I don't think it really
> > matters.
> >
> Well, if you have a conversion routine that converts (whatever the)
> netdev_type_t type is to the ethtool representation (array of u32 for
> example). So the changes would have to be done in that conversion
> routine only and not get/set_features() ethtool methods as such.

These are precisely those conversion routines, because there is no other
place that needs to deal with the ethtool representation...

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ