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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 11 Apr 2024 07:04:08 +0000
From: Daniel Machon <daniel.machon@...rochip.com>
To: Asbjørn Sloth Tønnesen <ast@...erby.net>
CC: <netdev@...r.kernel.org>, Steen Hegelund <Steen.Hegelund@...rochip.com>,
	Lars Povlsen <lars.povlsen@...rochip.com>, <UNGLinuxDriver@...rochip.com>,
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net v2] net: sparx5: flower: fix fragment flags handling

Hi Asbjørn,

I know I am nitpicking here, but could you please sneak in below
changes.

>  static int
>  sparx5_tc_flower_es0_tpid(struct vcap_tc_flower_parse_usage *st)
>  {
> @@ -145,29 +166,27 @@ sparx5_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st)
>         flow_rule_match_control(st->frule, &mt);
> 
>         if (mt.mask->flags) {
> -               if (mt.mask->flags & FLOW_DIS_FIRST_FRAG) {
> -                       if (mt.key->flags & FLOW_DIS_FIRST_FRAG) {
> -                               value = 1; /* initial fragment */
> -                               mask = 0x3;
> -                       } else {
> -                               if (mt.mask->flags & FLOW_DIS_IS_FRAGMENT) {
> -                                       value = 3; /* follow up fragment */
> -                                       mask = 0x3;
> -                               } else {
> -                                       value = 0; /* no fragment */
> -                                       mask = 0x3;
> -                               }
> -                       }
> -               } else {
> -                       if (mt.mask->flags & FLOW_DIS_IS_FRAGMENT) {
> -                               value = 3; /* follow up fragment */
> -                               mask = 0x3;
> -                       } else {
> -                               value = 0; /* no fragment */
> -                               mask = 0x3;
> -                       }
> +               u8 is_frag_key = !!(mt.key->flags & FLOW_DIS_IS_FRAGMENT);
> +               u8 is_frag_mask = !!(mt.mask->flags & FLOW_DIS_IS_FRAGMENT);
> +               u8 is_frag_idx = (is_frag_key << 1) | is_frag_mask;
> +
> +               u8 first_frag_key = !!(mt.key->flags & FLOW_DIS_FIRST_FRAG);
> +               u8 first_frag_mask = !!(mt.mask->flags & FLOW_DIS_FIRST_FRAG);
> +               u8 first_frag_idx = (first_frag_key << 1) | first_frag_mask;
> +
> +               /* lookup verdict based on the 2 + 2 input bits */
> +               u8 vdt = sparx5_vcap_frag_map[is_frag_idx][first_frag_idx];
> +
> +               if (vdt == FRAG_INVAL) {
> +                       NL_SET_ERR_MSG_MOD(st->fco->common.extack,
> +                                          "match on invalid fragment flag combination");

Please start this NL msg with a capital letter. All (AFAICS) other
places in this file do this - nice to stay consistent. As a matter of
fact, also do this to the new comments introduced.

> +                       return -EINVAL;
>                 }
> 
> +               /* extract VCAP fragment key and mask from verdict */
> +               value = (vdt >> 4) & 0x3;
> +               mask = vdt & 0x3;
> +
>                 err = vcap_rule_add_key_u32(st->vrule,
>                                             VCAP_KF_L3_FRAGMENT_TYPE,
>                                             value, mask);
> --
> 2.43.0
> 

Checkpatch is producing a warning about the placement of the version
information of the patch. Might as well fix this while at it.

Thanks,

/Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ