public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] mlxsw: spectrum: Introduce ACL core with simple TCAM implementation
Date: Tue, 07 Feb 2017 11:01:26 +0000	[thread overview]
Message-ID: <20170207110126.GA18959@mwanda> (raw)

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

             reply	other threads:[~2017-02-07 11:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 11:01 Dan Carpenter [this message]
2017-02-07 11:27 ` [bug report] mlxsw: spectrum: Introduce ACL core with simple TCAM implementation Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170207110126.GA18959@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox