From: Colin Ian King <colin.king@canonical.com>
To: Ido Schimmel <idosch@mellanox.com>
Cc: Jiri Pirko <jiri@mellanox.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Petr Machata <petrm@mellanox.com>,
netdev@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: mlxsw: spectrum: Adjust headroom buffers for 8x ports
Date: Wed, 17 Jun 2020 18:15:35 +0100 [thread overview]
Message-ID: <bae3b4f6-3e9b-bdde-72b0-b8f1e7575fd4@canonical.com> (raw)
Hi
Static analysis with Coverity has detected an issue that relies on the
machine endianness to work. The commit in question is:
commit 60833d54d56c21e7538296eb2e00e104768fd047
Author: Ido Schimmel <idosch@mellanox.com>
Date: Tue Jun 16 10:14:58 2020 +0300
mlxsw: spectrum: Adjust headroom buffers for 8x ports
in line:
mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, (u16 *) &buffsize);
The cast of the u32 buffsize to (u16 *) to scale buffsize in the call to
to mlxsw_sp_port_headroom_8x_adjust() will behave differently on big
endian architectures to that of little endian architectures. I'm not
sure if this is intentional or not.
One solution is to either make buffsize a u16, but I am concerned this
may be incorrect as the buffsize is assigned from the call
mlxsw_sp_span_buffsize_get() and this returns a u32 so we may have
overflow issues. Probably better to make
mlxsw_sp_port_headroom_8x_adjust handle u32 integers and to return the
adjusted value rather than modifying it by pass-by-reference.
Colin
next reply other threads:[~2020-06-17 17:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 17:15 Colin Ian King [this message]
2020-06-17 17:52 ` Ido Schimmel
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=bae3b4f6-3e9b-bdde-72b0-b8f1e7575fd4@canonical.com \
--to=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=petrm@mellanox.com \
/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
all inboxes | Powered by JetHome®