]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bnxt_en: fix ternary sign extension bug in bnxt_show_temp()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 22 Apr 2021 09:10:28 +0000 (12:10 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 08:50:16 +0000 (10:50 +0200)
commitdf40a70f6556d4c529e8edeaf5c947e4963f402a
tree34d930e20f56f26cab2943c47396d2ca36c3e129
parent9fadcc731f600e29cadd05ef6c0121a84056c3fd
bnxt_en: fix ternary sign extension bug in bnxt_show_temp()

[ Upstream commit 27537929f30d3136a71ef29db56127a33c92dad7 ]

The problem is that bnxt_show_temp() returns long but "rc" is an int
and "len" is a u32.  With ternary operations the type promotion is quite
tricky.  The negative "rc" is first promoted to u32 and then to long so
it ends up being a high positive value instead of a a negative as we
intended.

Fix this by removing the ternary.

Fixes: d69753fa1ecb ("bnxt_en: return proper error codes in bnxt_show_temp")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c