[bug report] mlxsw: spectrum: Introduce ACL core with simple TCAM implementation

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

 



Hello Jiri Pirko,

The patch 22a677661f56: "mlxsw: spectrum: Introduce ACL core with
simple TCAM implementation" from Feb 3, 2017, leads to the following
static checker warning:

	drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c:819 mlxsw_sp_acl_tcam_chunk_create()
	warn: impossible condition '(priority == (-1)) => (0-u32max == u64max)'

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
   810  static struct mlxsw_sp_acl_tcam_chunk *
   811  mlxsw_sp_acl_tcam_chunk_create(struct mlxsw_sp *mlxsw_sp,
   812                                 struct mlxsw_sp_acl_tcam_group *group,
   813                                 unsigned int priority,
                                       ^^^^^^^^^^^^^^^^^^^^^

This should probably be changed to unsigned long?

   814                                 struct mlxsw_afk_element_usage *elusage)
   815  {
   816          struct mlxsw_sp_acl_tcam_chunk *chunk;
   817          int err;
   818  
   819          if (priority == MLXSW_SP_ACL_TCAM_CATCHALL_PRIO)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UINT_MAX != ULONG_MAX on 64 bit systems.

   820                  return ERR_PTR(-EINVAL);
   821  
   822          chunk = kzalloc(sizeof(*chunk), GFP_KERNEL);
   823          if (!chunk)
   824                  return ERR_PTR(-ENOMEM);
   825          chunk->priority = priority;
   826          chunk->group = group;
   827          chunk->ref_count = 1;
   828  

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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