diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-07-04 19:04:42 -0400 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2012-09-18 21:56:23 -0400 |
commit | e3f5ec1108ee01b555d5894722884e40dbec058f (patch) | |
tree | f3e2d295c71bf271403c13674c2e69cf41a6ad11 /drivers/net/ethernet/sfc | |
parent | bfeed902946a31692e7a24ed355b6d13ac37d014 (diff) |
sfc: Support variable-length response to MCDI GET_BOARD_CFG
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc')
-rw-r--r-- | drivers/net/ethernet/sfc/mcdi.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/mtd.c | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index 578e5f72aabe..e855f4cddb4e 100644 --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c | |||
@@ -683,12 +683,14 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, | |||
683 | if (mac_address) | 683 | if (mac_address) |
684 | memcpy(mac_address, outbuf + offset, ETH_ALEN); | 684 | memcpy(mac_address, outbuf + offset, ETH_ALEN); |
685 | if (fw_subtype_list) { | 685 | if (fw_subtype_list) { |
686 | /* Byte-swap and truncate or zero-pad as necessary */ | ||
686 | offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST; | 687 | offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST; |
687 | for (i = 0; | 688 | for (i = 0; |
688 | i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM; | 689 | i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM; |
689 | i++) { | 690 | i++) { |
690 | fw_subtype_list[i] = | 691 | fw_subtype_list[i] = |
691 | le16_to_cpup((__le16 *)(outbuf + offset)); | 692 | (offset + 2 <= outlen) ? |
693 | le16_to_cpup((__le16 *)(outbuf + offset)) : 0; | ||
692 | offset += 2; | 694 | offset += 2; |
693 | } | 695 | } |
694 | } | 696 | } |
diff --git a/drivers/net/ethernet/sfc/mtd.c b/drivers/net/ethernet/sfc/mtd.c index 758148379b0e..8f4604d5d642 100644 --- a/drivers/net/ethernet/sfc/mtd.c +++ b/drivers/net/ethernet/sfc/mtd.c | |||
@@ -627,7 +627,8 @@ static int siena_mtd_get_fw_subtypes(struct efx_nic *efx, | |||
627 | struct efx_mtd *efx_mtd) | 627 | struct efx_mtd *efx_mtd) |
628 | { | 628 | { |
629 | struct efx_mtd_partition *part; | 629 | struct efx_mtd_partition *part; |
630 | uint16_t fw_subtype_list[MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM]; | 630 | uint16_t fw_subtype_list[ |
631 | MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM]; | ||
631 | int rc; | 632 | int rc; |
632 | 633 | ||
633 | rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL); | 634 | rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL); |