diff mbox series

[ovs-dev] odp-util: Fix Sparse warning in parse_odp_userspace_action().

Message ID 1515697283-63206-1-git-send-email-jpettit@ovn.org
State Accepted
Headers show
Series [ovs-dev] odp-util: Fix Sparse warning in parse_odp_userspace_action(). | expand

Commit Message

Justin Pettit Jan. 11, 2018, 7:01 p.m. UTC
Sparse complains with warning: incorrect type in argument 1 (different
base types) in function parse_odp_userspace_action due to a call to
htonll(rule_cookie).  The variable is read in host-byte order, so it
shouldn't have been declared as big-endian.

Fixes: d39ec23de384 ("ofproto-dpif: Don't slow-path controller actions.")
Reported-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
---
 lib/odp-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Jan. 11, 2018, 7:08 p.m. UTC | #1
On Thu, Jan 11, 2018 at 11:01:23AM -0800, Justin Pettit wrote:
> Sparse complains with warning: incorrect type in argument 1 (different
> base types) in function parse_odp_userspace_action due to a call to
> htonll(rule_cookie).  The variable is read in host-byte order, so it
> shouldn't have been declared as big-endian.
> 
> Fixes: d39ec23de384 ("ofproto-dpif: Don't slow-path controller actions.")
> Reported-by: Ian Stokes <ian.stokes@intel.com>
> Signed-off-by: Justin Pettit <jpettit@ovn.org>

For me, this fixes the sparse warning and keeps the unit tests passing.

Acked-by: Ben Pfaff <blp@ovn.org>
Stokes, Ian Jan. 11, 2018, 8:12 p.m. UTC | #2
> Sparse complains with warning: incorrect type in argument 1 (different
> base types) in function parse_odp_userspace_action due to a call to
> htonll(rule_cookie).  The variable is read in host-byte order, so it
> shouldn't have been declared as big-endian.
> 
> Fixes: d39ec23de384 ("ofproto-dpif: Don't slow-path controller actions.")
> Reported-by: Ian Stokes <ian.stokes@intel.com>
> Signed-off-by: Justin Pettit <jpettit@ovn.org>
> ---
>  lib/odp-util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/odp-util.c b/lib/odp-util.c index
> f8c84e17330f..0b836569fdc5 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> @@ -1151,7 +1151,7 @@ parse_odp_userspace_action(const char *s, struct
> ofpbuf *actions)
>          uint8_t continuation;
>          uint16_t reason;
>          uint32_t recirc_id;
> -        ovs_be64 rule_cookie;
> +        uint64_t rule_cookie;
>          uint16_t controller_id;
>          uint16_t max_len;

LGTM and tested without issue, 

Acked-by: Ian Stokes <ian.stokes@intel.com>
Tested-by: Ian Stokes <ian.stokes@intel.com>

> 
> --
> 2.7.4
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Justin Pettit Jan. 11, 2018, 8:58 p.m. UTC | #3
> On Jan 11, 2018, at 12:12 PM, Stokes, Ian <ian.stokes@intel.com> wrote:
> 
>> Sparse complains with warning: incorrect type in argument 1 (different
>> base types) in function parse_odp_userspace_action due to a call to
>> htonll(rule_cookie).  The variable is read in host-byte order, so it
>> shouldn't have been declared as big-endian.
>> 
>> Fixes: d39ec23de384 ("ofproto-dpif: Don't slow-path controller actions.")
>> Reported-by: Ian Stokes <ian.stokes@intel.com>
>> Signed-off-by: Justin Pettit <jpettit@ovn.org>
>> ---
>> lib/odp-util.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/lib/odp-util.c b/lib/odp-util.c index
>> f8c84e17330f..0b836569fdc5 100644
>> --- a/lib/odp-util.c
>> +++ b/lib/odp-util.c
>> @@ -1151,7 +1151,7 @@ parse_odp_userspace_action(const char *s, struct
>> ofpbuf *actions)
>>         uint8_t continuation;
>>         uint16_t reason;
>>         uint32_t recirc_id;
>> -        ovs_be64 rule_cookie;
>> +        uint64_t rule_cookie;
>>         uint16_t controller_id;
>>         uint16_t max_len;
> 
> LGTM and tested without issue, 
> 
> Acked-by: Ian Stokes <ian.stokes@intel.com>
> Tested-by: Ian Stokes <ian.stokes@intel.com>

Thanks for testing and reporting the error!  I pushed this to master.

--Justin
diff mbox series

Patch

diff --git a/lib/odp-util.c b/lib/odp-util.c
index f8c84e17330f..0b836569fdc5 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -1151,7 +1151,7 @@  parse_odp_userspace_action(const char *s, struct ofpbuf *actions)
         uint8_t continuation;
         uint16_t reason;
         uint32_t recirc_id;
-        ovs_be64 rule_cookie;
+        uint64_t rule_cookie;
         uint16_t controller_id;
         uint16_t max_len;