[ovs-dev] [PATCH v4 1/3] nsh: fix an implicit bug in nsh_hdr_len

Jan Scheurich jan.scheurich at ericsson.com
Mon Aug 28 11:59:00 UTC 2017


>  static inline uint16_t
>  nsh_hdr_len(const struct nsh_hdr *nsh)
>  {
> -    return 4 * (ntohs(nsh->ver_flags_len) & NSH_LEN_MASK) >>
> NSH_LEN_SHIFT;
> +    return ((ntohs(nsh->ver_flags_len) & NSH_LEN_MASK) >>
> + NSH_LEN_SHIFT) << 2;
>  }
> 

Why do you not just add the missing braces?

return 4 * ((ntohs(nsh->ver_flags_len) & NSH_LEN_MASK) >> NSH_LEN_SHIFT);

BR, Jan


More information about the dev mailing list