net/qede: fix build with GCC 13
authorFerruh Yigit <ferruh.yigit@xilinx.com>
Thu, 16 Jun 2022 17:02:09 +0000 (18:02 +0100)
committerJerin Jacob <jerinj@marvell.com>
Mon, 20 Jun 2022 17:27:03 +0000 (19:27 +0200)
Reproduced with "gcc (GCC) 13.0.0 20220616 (experimental)"

Build error:
In file included from ../drivers/net/qede/qede_debug.c:9:
../drivers/net/qede/qede_debug.c: In function ‘qed_grc_dump_addr_range’:
../drivers/net/qede/base/ecore.h:95:17:
warning: overflow in conversion from ‘int’ to ‘u8’
{aka ‘unsigned char’} changes value from ‘(int)vf_id << 8 | 128’
to ‘128’ [-Woverflow]
   95 |                 ((_value & _name##_MASK) << _name##_SHIFT)
      |                 ^
../drivers/net/qede/qede_debug.c:1907:31:
note: in expansion of macro ‘FIELD_VALUE’
 1907 |         fid = FIELD_VALUE(PXP_PRETEND_CONCRETE_FID_VFVALID, 1)
      |               ^~~~~~~~~~~

To prevent overflow converting 'fib' to uint16_t,
while updating it also updated 'vf_id' to 16 bit too.

Fixes: ec55c118792b ("net/qede: add infrastructure for debug data collection")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
Acked-by: Devendra Singh Rawat <dsinghrawat@marvell.com>
drivers/net/qede/qede_debug.c

index 9383a6d..18f2d98 100644 (file)
@@ -1809,7 +1809,8 @@ static u32 qed_grc_dump_addr_range(struct ecore_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;
+       u16 vf_id = 0, fid = 0;
        bool read_using_dmae = false;
        u32 thresh;