linux/drivers/net/ethernet/broadcom/bnxt
Damien Le Moal dcf500065f net: bnxt_ptp: fix compilation error
The Broadcom bnxt_ptp driver does not compile with GCC 11.2.2 when
CONFIG_WERROR is enabled. The following error is generated:

drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c: In function ‘bnxt_ptp_enable’:
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c:400:43: error: array
subscript 255 is above array bounds of ‘struct pps_pin[4]’
[-Werror=array-bounds]
  400 |  ptp->pps_info.pins[pin_id].event = BNXT_PPS_EVENT_EXTERNAL;
      |  ~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c:20:
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h:75:24: note: while
referencing ‘pins’
   75 |         struct pps_pin pins[BNXT_MAX_TSIO_PINS];
      |                        ^~~~
cc1: all warnings being treated as errors

This is due to the function ptp_find_pin() returning a pin ID of -1 when
a valid pin is not found and this error never being checked.
Change the TSIO_PIN_VALID() function to also check that a pin ID is not
negative and use this macro in bnxt_ptp_enable() to check the result of
the calls to ptp_find_pin() to return an error early for invalid pins.
This fixes the compilation error.

Cc: <stable@vger.kernel.org>
Fixes: 9e518f2580 ("bnxt_en: 1PPS functions to configure TSIO pins")
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20220328062708.207079-1-damien.lemoal@opensource.wdc.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-03-28 13:29:32 -07:00
..
Makefile bnxt_en: move coredump functions into dedicated file 2021-10-29 12:13:05 +01:00
bnxt.c bnxt: use the devlink instance lock to protect sriov 2022-03-21 14:11:38 +00:00
bnxt.h bnxt: use the devlink instance lock to protect sriov 2022-03-21 14:11:38 +00:00
bnxt_coredump.c bnxt_en: use firmware provided max timeout for messages 2022-01-09 16:27:23 -08:00
bnxt_coredump.h bnxt_en: move coredump functions into dedicated file 2021-10-29 12:13:05 +01:00
bnxt_dcb.c bnxt_en: Properly report no pause support on some cards 2022-03-05 11:16:56 +00:00
bnxt_dcb.h bnxt_en: Use struct_group_attr() for memcpy() region 2021-09-25 08:20:48 -07:00
bnxt_debugfs.c
bnxt_debugfs.h
bnxt_devlink.c bnxt: revert hastily merged uAPI aberrations 2022-03-09 19:55:00 -08:00
bnxt_devlink.h bnxt: revert hastily merged uAPI aberrations 2022-03-09 19:55:00 -08:00
bnxt_dim.c
bnxt_ethtool.c bnxt: revert hastily merged uAPI aberrations 2022-03-09 19:55:00 -08:00
bnxt_ethtool.h bnxt: revert hastily merged uAPI aberrations 2022-03-09 19:55:00 -08:00
bnxt_fw_hdr.h
bnxt_hsi.h bnxt_en: Update firmware interface to 1.10.2.73 2022-01-26 15:35:20 +00:00
bnxt_hwrm.c bnxt_en: Increase firmware message response DMA wait time 2022-02-20 13:47:15 +00:00
bnxt_hwrm.h bnxt_en: Increase firmware message response DMA wait time 2022-02-20 13:47:15 +00:00
bnxt_nvm_defs.h
bnxt_ptp.c net: bnxt_ptp: fix compilation error 2022-03-28 13:29:32 -07:00
bnxt_ptp.h net: bnxt_ptp: fix compilation error 2022-03-28 13:29:32 -07:00
bnxt_sriov.c bnxt: use the devlink instance lock to protect sriov 2022-03-21 14:11:38 +00:00
bnxt_sriov.h ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
bnxt_tc.c flow_offload: reject to offload tc actions in offload drivers 2021-12-19 14:08:47 +00:00
bnxt_tc.h
bnxt_ulp.c bnxt_en: update all firmware calls to use the new APIs 2021-08-30 09:35:04 +01:00
bnxt_ulp.h bnxt_en: Remove not used other ULP define 2021-10-29 21:21:09 -07:00
bnxt_vfr.c devlink: hold the instance lock during eswitch_mode callbacks 2022-03-21 14:11:38 +00:00
bnxt_vfr.h bnxt_en: Free and allocate VF-Reps during error recovery. 2021-04-12 13:20:38 -07:00
bnxt_xdp.c bpf: Let bpf_warn_invalid_xdp_action() report more info 2021-12-13 22:28:27 +01:00
bnxt_xdp.h