public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] mlxsw: spectrum: Introduce ACL core with simple TCAM implementation
@ 2017-02-07 11:01 Dan Carpenter
  2017-02-07 11:27 ` Jiri Pirko
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-02-07 11:01 UTC (permalink / raw)
  To: kernel-janitors

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-07 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 11:01 [bug report] mlxsw: spectrum: Introduce ACL core with simple TCAM implementation Dan Carpenter
2017-02-07 11:27 ` Jiri Pirko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox