[bug report] net/mlx5: E-Switch, Refactor eswitch ingress acl codes

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

 



Hello Vu Pham,

The patch 07bab9502641: "net/mlx5: E-Switch, Refactor eswitch ingress
acl codes" from Mar 27, 2020, leads to the following static checker
warning:

	drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c:184 esw_acl_ingress_lgcy_setup()
	warn: passing zero to 'PTR_ERR'

drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c
  163          if (MLX5_CAP_ESW_INGRESS_ACL(esw->dev, flow_counter)) {
   164                  counter = mlx5_fc_create(esw->dev, false);
   165                  if (IS_ERR(counter)) {
   166                          esw_warn(esw->dev,
   167                                   "vport[%d] configure ingress drop rule counter failed\n",
   168                                   vport->vport);
   169                          counter = NULL;
   170                  }
   171                  vport->ingress.legacy.drop_counter = counter;
   172          }
   173  
   174          if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) {
   175                  esw_acl_ingress_lgcy_cleanup(esw, vport);
   176                  return 0;
   177          }
   178  
   179          if (!vport->ingress.acl) {
   180                  vport->ingress.acl = esw_acl_table_create(esw, vport->vport,
   181                                                            MLX5_FLOW_NAMESPACE_ESW_INGRESS,
   182                                                            table_size);
   183                  if (IS_ERR_OR_NULL(vport->ingress.acl)) {
   184                          err = PTR_ERR(vport->ingress.acl);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
esw_acl_table_create() doesn't return NULL, but if it did that would
mean "err = 0;" (ie.  The success path).

When a function returns both error pointers and NULL then the NULL
return is meant to be an optional thing where the feature has been
manually disabled by the admin or by the kernel config.

   185                          vport->ingress.acl = NULL;
   186                          return err;
   187                  }
   188  
   189                  err = esw_acl_ingress_lgcy_groups_create(esw, vport);
   190                  if (err)
   191                          goto out;
   192          }
   193  
   194          esw_debug(esw->dev,
   195                    "vport[%d] configure ingress rules, vlan(%d) qos(%d)\n",
   196                    vport->vport, vport->info.vlan, vport->info.qos);

regards,
dan carpenter



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux