[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <bae3b4f6-3e9b-bdde-72b0-b8f1e7575fd4@canonical.com>
Date: Wed, 17 Jun 2020 18:15:35 +0100
From: Colin Ian King <colin.king@...onical.com>
To: Ido Schimmel <idosch@...lanox.com>
Cc: Jiri Pirko <jiri@...lanox.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Petr Machata <petrm@...lanox.com>, netdev@...r.kernel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: re: mlxsw: spectrum: Adjust headroom buffers for 8x ports
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@...lanox.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
Powered by blists - more mailing lists