Re: [bug report] net: microchip: sparx5: Match keys in configured port keysets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

On Tue, 2022-11-15 at 17:14 +0300, Dan Carpenter wrote:
> [You don't often get email from error27@xxxxxxxxx. Learn why this is important
> at https://aka.ms/LearnAboutSenderIdentification ;]
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
> 
> Hello Steen Hegelund,
> 
> The patch abc4010d1f6e: "net: microchip: sparx5: Match keys in
> configured port keysets" from Nov 9, 2022, leads to the following
> Smatch static checker warning:
> 
>         drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c:598
> sparx5_tc_flower_replace()
>         error: uninitialized symbol 'l3_proto'.

Yes this should be initialized in case the "basic" dissector is not triggered
(which is probably not possible since the TC framework would prevent this).
 
> 
> drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
>     532 static int sparx5_tc_flower_replace(struct net_device *ndev,
>     533                                     struct flow_cls_offload *fco,
>     534                                     struct vcap_admin *admin)
>     535 {
>     536         struct sparx5_port *port = netdev_priv(ndev);
>     537         struct flow_action_entry *act;
>     538         struct vcap_control *vctrl;
>     539         struct flow_rule *frule;
>     540         struct vcap_rule *vrule;
>     541         u16 l3_proto;
>     542         int err, idx;
>     543
>     544         vctrl = port->sparx5->vcap_ctrl;
>     545
>     546         err = sparx5_tc_flower_action_check(vctrl, fco, admin);
>     547         if (err)
>     548                 return err;
>     549
>     550         vrule = vcap_alloc_rule(vctrl, ndev, fco->common.chain_index,
> VCAP_USER_TC,
>     551                                 fco->common.prio, 0);
>     552         if (IS_ERR(vrule))
>     553                 return PTR_ERR(vrule);
>     554
>     555         vrule->cookie = fco->cookie;
>     556         sparx5_tc_use_dissectors(fco, admin, vrule, &l3_proto);
> 
> Should this call to sparx5_tc_use_dissectors() have error checking?

I will add that.

> 
>     557         frule = flow_cls_offload_flow_rule(fco);
>     558         flow_action_for_each(idx, act, &frule->action) {
>     559                 switch (act->id) {
>     560                 case FLOW_ACTION_TRAP:
>     561                         err = vcap_rule_add_action_bit(vrule,
>     562                                                       
> VCAP_AF_CPU_COPY_ENA,
>     563                                                        VCAP_BIT_1);
>     564                         if (err)
>     565                                 goto out;
>     566                         err = vcap_rule_add_action_u32(vrule,
>     567                                                       
> VCAP_AF_CPU_QUEUE_NUM, 0);
>     568                         if (err)
>     569                                 goto out;
>     570                         err = vcap_rule_add_action_u32(vrule,
> VCAP_AF_MASK_MODE,
>     571                                                       
> SPX5_PMM_REPLACE_ALL);
>     572                         if (err)
>     573                                 goto out;
>     574                         /* For now the actionset is hardcoded */
>     575                         err = vcap_set_rule_set_actionset(vrule,
>     576                                                          
> VCAP_AFS_BASE_TYPE);
>     577                         if (err)
>     578                                 goto out;
>     579                         break;
>     580                 case FLOW_ACTION_ACCEPT:
>     581                         /* For now the actionset is hardcoded */
>     582                         err = vcap_set_rule_set_actionset(vrule,
>     583                                                          
> VCAP_AFS_BASE_TYPE);
>     584                         if (err)
>     585                                 goto out;
>     586                         break;
>     587                 case FLOW_ACTION_GOTO:
>     588                         /* Links between VCAPs will be added later */
>     589                         break;
>     590                 default:
>     591                         NL_SET_ERR_MSG_MOD(fco->common.extack,
>     592                                            "Unsupported TC action");
>     593                         err = -EOPNOTSUPP;
>     594                         goto out;
>     595                 }
>     596         }
>     597         /* provide the l3 protocol to guide the keyset selection */
> --> 598         err = vcap_val_rule(vrule, l3_proto);
>     599         if (err) {
>     600                 vcap_set_tc_exterr(fco, vrule);
>     601                 goto out;
>     602         }
>     603         err = vcap_add_rule(vrule);
>     604         if (err)
>     605                 NL_SET_ERR_MSG_MOD(fco->common.extack,
>     606                                    "Could not add the filter");
>     607 out:
>     608         vcap_free_rule(vrule);
>     609         return err;
>     610 }
> 
> regards,
> dan carpenter

Thanks for the error report.

I will add the fixes for this in my next series.

BR
Steen






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux