Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-net-drivers@solarflare.com>
Subject: [PATCH net-next 08/11] sfc: Support variable-length response to MCDI GET_BOARD_CFG
Date: Wed, 19 Sep 2012 20:17:56 +0100	[thread overview]
Message-ID: <1348082276.2636.23.camel@bwh-desktop.uk.solarflarecom.com> (raw)
In-Reply-To: <1348081775.2636.15.camel@bwh-desktop.uk.solarflarecom.com>

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/ethernet/sfc/mcdi.c |    6 ++++--
 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 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;
 		}
 	}
diff --git a/drivers/net/ethernet/sfc/mtd.c b/drivers/net/ethernet/sfc/mtd.c
index 7581483..8f4604d 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,
 				     struct efx_mtd *efx_mtd)
 {
 	struct efx_mtd_partition *part;
-	uint16_t fw_subtype_list[MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM];
+	uint16_t fw_subtype_list[
+		MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM];
 	int rc;
 
 	rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL);
-- 
1.7.7.6



-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

  parent reply	other threads:[~2012-09-19 19:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 19:09 Pull request: sfc-next 2012-09-19 Ben Hutchings
2012-09-19 19:13 ` [PATCH net-next 01/11] pps/ptp: Allow PHC devices to adjust PPS events for known delay Ben Hutchings
2012-09-20  6:57   ` Richard Cochran
2012-09-20  7:29   ` Rodolfo Giometti
2012-09-19 19:14 ` [PATCH net-next 02/11] sfc: Add explicit RX queue flag to channel Ben Hutchings
2012-09-19 19:15 ` [PATCH net-next 03/11] sfc: Add channel specific receive_skb handler and post_remove callback Ben Hutchings
2012-09-19 19:16 ` [PATCH net-next 04/11] sfc: Allow efx_mcdi_rpc to be called in two parts Ben Hutchings
2012-09-19 19:16 ` [PATCH net-next 05/11] sfc: Fix maximum array sizes for various MCDI commands Ben Hutchings
2012-09-19 19:17 ` [PATCH net-next 06/11] sfc: Add support for IEEE-1588 PTP Ben Hutchings
2012-09-20  6:59   ` Richard Cochran
2012-09-19 19:17 ` [PATCH net-next 07/11] sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg() Ben Hutchings
2012-09-19 19:17 ` Ben Hutchings [this message]
2012-09-19 19:18 ` [PATCH net-next 09/11] sfc: Expose FPGA bitfile partition through MTD Ben Hutchings
2012-09-19 19:18 ` [PATCH net-next 10/11] sfc: Bump version to 3.2 Ben Hutchings
2012-09-19 19:18 ` [PATCH net-next 11/11] sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES request Ben Hutchings
2012-09-20 20:42 ` Pull request: sfc-next 2012-09-19 David Miller

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=1348082276.2636.23.camel@bwh-desktop.uk.solarflarecom.com \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@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