[PATCH xenial] ethtool.h: define INT_MAX for userland

Andy Gospodarek gospo at cumulusnetworks.com
Wed Jun 15 18:29:50 UTC 2016


On Wed, Jun 15, 2016 at 11:15:57AM -0700, Kamal Mostafa wrote:
> Oh, actually, this needs a Launchpad bug for tracking... Andy, please
> file one and let us know the bug number.  Thanks!

I tried to piggy-back on the previous bug for this, but just created a
new one:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1592930


> 
>  -Kamal
> 
> 
> On Wed, Jun 15, 2016 at 01:40:59PM -0400, Andy Gospodarek wrote:
> > From: Nicolas Dichtel <nicolas.dichtel at 6wind.com>
> > 
> > INT_MAX needs limits.h in userland.
> > When ethtool.h is included by a userland app, we got the following error:
> > 
> > .../usr/include/linux/ethtool.h: In function 'ethtool_validate_speed':
> > .../usr/include/linux/ethtool.h:1471:18: error: 'INT_MAX' undeclared (first use in this function)
> >   return speed <= INT_MAX || speed == SPEED_UNKNOWN
> >                   ^
> > Fixes: 72f843bdbdca ("ethtool: make validate_speed accept all speeds between 0 and INT_MAX")
> > CC: Nikolay Aleksandrov <nikolay at cumulusnetworks.com>
> > Signed-off-by: Nicolas Dichtel <nicolas.dichtel at 6wind.com>
> > Acked-by: Nikolay Aleksandrov <nikolay at cumulusnetworks.com>
> > Signed-off-by: David S. Miller <davem at davemloft.net>
> > (cherry picked from commit 14e2037902d65213842b4e40305ff54a64abbcb6)
> > Signed-off-by: Andy Gospodarek <gospo at cumulusnetworks.com>
> > Reported-by: Iain Lane <iain at orangesquash.org.uk>
> > ---
> >  include/uapi/linux/ethtool.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> > index f1b71ca..3032139 100644
> > --- a/include/uapi/linux/ethtool.h
> > +++ b/include/uapi/linux/ethtool.h
> > @@ -16,6 +16,10 @@
> >  #include <linux/types.h>
> >  #include <linux/if_ether.h>
> >  
> > +#ifndef __KERNEL__
> > +#include <limits.h> /* for INT_MAX */
> > +#endif
> > +
> >  /* All structures exposed to userland should be defined such that they
> >   * have the same layout for 32-bit and 64-bit userland.
> >   */
> > -- 
> > 2.7.4
> > 
> > 
> > -- 
> > kernel-team mailing list
> > kernel-team at lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/kernel-team




More information about the kernel-team mailing list