All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] uapi: fix signess in ethtool_validate_speed()
@ 2017-01-20 13:20 Volodymyr Bendiuga
  2017-01-20 16:36 ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Volodymyr Bendiuga @ 2017-01-20 13:20 UTC (permalink / raw)
  To: davem, mst, nikolay, netdev, volodymyr.bendiuga
  Cc: Jonas Johansson, Volodymyr Bendiuga

From: Jonas Johansson <jonas.johansson@westermo.se>

There is a comparison of speed  variable which
is unsigned, and SPEED_UNKNOWN which is signed.

Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se>
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>
---
 include/uapi/linux/ethtool.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index f0db778..1ca4a77 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -1500,7 +1500,7 @@ enum ethtool_link_mode_bit_indices {
 
 #define SPEED_UNKNOWN		-1
 
-static inline int ethtool_validate_speed(__u32 speed)
+static inline int ethtool_validate_speed(__s32 speed)
 {
 	return speed <= INT_MAX || speed == SPEED_UNKNOWN;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] uapi: fix signess in ethtool_validate_speed()
  2017-01-20 13:20 [PATCH net-next] uapi: fix signess in ethtool_validate_speed() Volodymyr Bendiuga
@ 2017-01-20 16:36 ` Michael S. Tsirkin
       [not found]   ` <CABHmqqAaram+jGGfAM4qGRSuucxZag-pRoc2aBqgQsnWVzNRUQ@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-01-20 16:36 UTC (permalink / raw)
  To: Volodymyr Bendiuga
  Cc: davem, nikolay, netdev, volodymyr.bendiuga, Jonas Johansson

On Fri, Jan 20, 2017 at 02:20:53PM +0100, Volodymyr Bendiuga wrote:
> From: Jonas Johansson <jonas.johansson@westermo.se>
> 
> There is a comparison of speed  variable which
> is unsigned, and SPEED_UNKNOWN which is signed.

So?

> 
> Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se>
> Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>
> ---
>  include/uapi/linux/ethtool.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index f0db778..1ca4a77 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -1500,7 +1500,7 @@ enum ethtool_link_mode_bit_indices {
>  
>  #define SPEED_UNKNOWN		-1
>  
> -static inline int ethtool_validate_speed(__u32 speed)
> +static inline int ethtool_validate_speed(__s32 speed)
>  {
>  	return speed <= INT_MAX || speed == SPEED_UNKNOWN;
>  }

Then comparison to INT_MAX does not make sense.

> -- 
> 2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] uapi: fix signess in ethtool_validate_speed()
       [not found]   ` <CABHmqqAaram+jGGfAM4qGRSuucxZag-pRoc2aBqgQsnWVzNRUQ@mail.gmail.com>
@ 2017-01-24 14:51     ` Michael S. Tsirkin
  0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-01-24 14:51 UTC (permalink / raw)
  To: Volodymyr Bendiuga
  Cc: David Miller, nikolay, netdev, Volodymyr Bendiuga, Jonas Johansson

On Tue, Jan 24, 2017 at 03:45:25PM +0100, Volodymyr Bendiuga wrote:
> On Fri, Jan 20, 2017 at 5:36 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> 
>     On Fri, Jan 20, 2017 at 02:20:53PM +0100, Volodymyr Bendiuga wrote:
>     > From: Jonas Johansson <jonas.johansson@westermo.se>
>     >
>     > There is a comparison of speed  variable which
>     > is unsigned, and SPEED_UNKNOWN which is signed.
> 
>     So?
>    
>     >
>     > Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se>
>     > Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>
>     > ---
>     >  include/uapi/linux/ethtool.h | 2 +-
>     >  1 file changed, 1 insertion(+), 1 deletion(-)
>     >
>     > diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
>     > index f0db778..1ca4a77 100644
>     > --- a/include/uapi/linux/ethtool.h
>     > +++ b/include/uapi/linux/ethtool.h
>     > @@ -1500,7 +1500,7 @@ enum ethtool_link_mode_bit_indices {
>     >
>     >  #define SPEED_UNKNOWN                -1
>     >
>     > -static inline int ethtool_validate_speed(__u32 speed)
>     > +static inline int ethtool_validate_speed(__s32 speed)
>     >  {
>     >       return speed <= INT_MAX || speed == SPEED_UNKNOWN;
>     >  }
> 
>     Then comparison to INT_MAX does not make sense.
> 
> Why doesn't it make sense?
> 

A signed integer is always <= INT_MAX.


-- 
MST

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-24 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-20 13:20 [PATCH net-next] uapi: fix signess in ethtool_validate_speed() Volodymyr Bendiuga
2017-01-20 16:36 ` Michael S. Tsirkin
     [not found]   ` <CABHmqqAaram+jGGfAM4qGRSuucxZag-pRoc2aBqgQsnWVzNRUQ@mail.gmail.com>
2017-01-24 14:51     ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.