From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] mlxsw: spectrum: Adjust headroom buffers for 8x ports
Date: Fri, 19 Jun 2020 10:09:07 +0000 [thread overview]
Message-ID: <20200619100907.GA246319@mwanda> (raw)
Hello Ido Schimmel,
The patch 60833d54d56c: "mlxsw: spectrum: Adjust headroom buffers for
8x ports" from Jun 16, 2020, leads to the following static checker
warning:
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c:785 mlxsw_sp_span_port_buffer_update()
warn: passing casted pointer '&buffsize' to 'mlxsw_sp_port_headroom_8x_adjust()' 32 vs 16.
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c
769 static int
770 mlxsw_sp_span_port_buffer_update(struct mlxsw_sp_port *mlxsw_sp_port, u16 mtu)
771 {
772 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
773 char sbib_pl[MLXSW_REG_SBIB_LEN];
774 u32 buffsize;
^^^^^^^^^^^^
775 u32 speed;
776 int err;
777
778 err = mlxsw_sp_port_speed_get(mlxsw_sp_port, &speed);
779 if (err)
780 return err;
781 if (speed = SPEED_UNKNOWN)
782 speed = 0;
783
784 buffsize = mlxsw_sp_span_buffsize_get(mlxsw_sp, speed, mtu);
785 mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, (u16 *) &buffsize);
^^^^^^^^^^^^^^^^^
This will work if 1) we are on a littel endian system and 2) "buffsize"
is less than USHRT_MAX / 2 but it's super ugly... :/
786 mlxsw_reg_sbib_pack(sbib_pl, mlxsw_sp_port->local_port, buffsize);
787 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl);
788 }
regards,
dan carpenter
next reply other threads:[~2020-06-19 10:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 10:09 Dan Carpenter [this message]
2020-06-19 13:01 ` [bug report] mlxsw: spectrum: Adjust headroom buffers for 8x ports Ido Schimmel
2020-06-19 13:25 ` Dan Carpenter
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=20200619100907.GA246319@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;
as well as URLs for NNTP newsgroup(s).