netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>,
	Martin Liska <mliska@suse.cz>, Ariel Elior <aelior@marvell.com>,
	Manish Chopra <manishc@marvell.com>,
	Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.15 10/46] qed (gcc13): use u16 for fid to be big enough
Date: Sun, 18 Dec 2022 11:12:08 -0500	[thread overview]
Message-ID: <20221218161244.930785-10-sashal@kernel.org> (raw)
In-Reply-To: <20221218161244.930785-1-sashal@kernel.org>

From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>

[ Upstream commit 7d84118229bf7f7290438c85caa8e49de52d50c1 ]

gcc 13 correctly reports overflow in qed_grc_dump_addr_range():
In file included from drivers/net/ethernet/qlogic/qed/qed.h:23,
                 from drivers/net/ethernet/qlogic/qed/qed_debug.c:10:
drivers/net/ethernet/qlogic/qed/qed_debug.c: In function 'qed_grc_dump_addr_range':
include/linux/qed/qed_if.h:1217:9: error: overflow in conversion from 'int' to 'u8' {aka 'unsigned char'} changes value from '(int)vf_id << 8 | 128' to '128' [-Werror=overflow]

We do:
  u8 fid;
  ...
  fid = vf_id << 8 | 128;

Since fid is 16bit (and the stored value above too), fid should be u16,
not u8. Fix that.

Cc: Martin Liska <mliska@suse.cz>
Cc: Ariel Elior <aelior@marvell.com>
Cc: Manish Chopra <manishc@marvell.com>
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20221031114354.10398-1-jirislaby@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/qlogic/qed/qed_debug.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_debug.c b/drivers/net/ethernet/qlogic/qed/qed_debug.c
index 6ab3e60d4928..4b4077cf2d26 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_debug.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c
@@ -1796,9 +1796,10 @@ static u32 qed_grc_dump_addr_range(struct qed_hwfn *p_hwfn,
 				   u8 split_id)
 {
 	struct dbg_tools_data *dev_data = &p_hwfn->dbg_info;
-	u8 port_id = 0, pf_id = 0, vf_id = 0, fid = 0;
+	u8 port_id = 0, pf_id = 0, vf_id = 0;
 	bool read_using_dmae = false;
 	u32 thresh;
+	u16 fid;
 
 	if (!dump)
 		return len;
-- 
2.35.1


  parent reply	other threads:[~2022-12-18 16:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221218161244.930785-1-sashal@kernel.org>
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 03/46] brcmfmac: return error when getting invalid max_flowrings from dongle Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 04/46] wifi: ath9k: verify the expected usb_endpoints are present Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 05/46] wifi: ar5523: Fix use-after-free on ar5523_cmd() timed out Sasha Levin
2022-12-18 16:12 ` Sasha Levin [this message]
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 11/46] bpf: make sure skb->len != 0 when redirecting to a tunneling device Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 12/46] net: ethernet: ti: Fix return type of netcp_ndo_start_xmit() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 13/46] hamradio: baycom_epp: Fix return type of baycom_send_packet() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 14/46] wifi: brcmfmac: Fix potential shift-out-of-bounds in brcmf_fw_alloc_request() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 15/46] igb: Do not free q_vector unless new one was allocated Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 18/46] s390/ctcm: Fix return type of ctc{mp,}m_tx() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 19/46] s390/netiucv: Fix return type of netiucv_tx() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 20/46] s390/lcs: Fix return type of lcs_start_xmit() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 28/46] net: add atomic_long_t to net_device_stats fields Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 29/46] ipv6/sit: use DEV_STATS_INC() to avoid data-races Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 30/46] mrp: introduce active flags to prevent UAF when applicant uninit Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 31/46] ppp: associate skb with a device at tx Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 33/46] ethtool: avoiding integer overflow in ethtool_phys_id() Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 41/46] net: dpaa2: publish MAC stringset to ethtool -S even if MAC is missing Sasha Levin
2022-12-19 11:54   ` Vladimir Oltean
2022-12-24  0:29     ` Sasha Levin
2022-12-18 16:12 ` [PATCH AUTOSEL 5.15 42/46] wifi: mt76: do not run mt76u_status_worker if the device is not running Sasha Levin

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=20221218161244.930785-10-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=aelior@marvell.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jirislaby@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=mliska@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@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).