diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-07-05 00:04:42 +0100 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2012-09-19 02:56:23 +0100 |
commit | e3f5ec1108ee01b555d5894722884e40dbec058f (patch) | |
tree | f3e2d295c71bf271403c13674c2e69cf41a6ad11 /drivers/net/ethernet/sfc/mcdi.c | |
parent | bfeed902946a31692e7a24ed355b6d13ac37d014 (diff) | |
download | op-kernel-dev-e3f5ec1108ee01b555d5894722884e40dbec058f.zip op-kernel-dev-e3f5ec1108ee01b555d5894722884e40dbec058f.tar.gz |
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/mcdi.c')
-rw-r--r-- | drivers/net/ethernet/sfc/mcdi.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index 578e5f7..e855f4c 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, if (mac_address) memcpy(mac_address, outbuf + offset, ETH_ALEN); if (fw_subtype_list) { + /* Byte-swap and truncate or zero-pad as necessary */ offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST; for (i = 0; - i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM; + i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM; i++) { fw_subtype_list[i] = - le16_to_cpup((__le16 *)(outbuf + offset)); + (offset + 2 <= outlen) ? + le16_to_cpup((__le16 *)(outbuf + offset)) : 0; offset += 2; } } |