lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20141203080741.GA21760@hariprasad-pc>
Date:	Wed, 3 Dec 2014 13:37:42 +0530
From:	Hariprasad S <hariprasad@...lsio.com>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
CC:	<netdev@...r.kernel.org>, <davem@...emloft.net>,
	<leedom@...lsio.com>, <anish@...lsio.com>, <nirranjan@...lsio.com>,
	<kumaras@...lsio.com>
Subject: Re: [PATCH net] cxgb4: Add a check for flashing FW using ethtool

On Tue, Dec 02, 2014 at 17:18:45 +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 12/2/2014 3:09 PM, Hariprasad Shenai wrote:
> 
> >Don't let T4 firmware flash on a T5 adapter and vice-versa
> >using ethtool
> 
> >Based on original work by Casey Leedom <leedom@...lsio.com>
> 
> >Signed-off-by: Hariprasad Shenai <hariprasad@...lsio.com>
> >---
> >  drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |   26 ++++++++++++++++++++++++++
> >  1 files changed, 26 insertions(+), 0 deletions(-)
> 
> >diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
> >index 163a2a1..fae205a 100644
> >--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
> >+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
> >@@ -1131,6 +1131,27 @@ unsigned int t4_flash_cfg_addr(struct adapter *adapter)
> >  		return FLASH_CFG_START;
> >  }
> >
> >+/* Return TRUE if the specified firmware matches the adapter.  I.e. T4
> >+ * firmware for T4 adapters, T5 firmware for T5 adapters, etc.  We go ahead
> >+ * and emit an error message for mismatched firmware to save our caller the
> >+ * effort ...
> >+ */
> >+static int t4_fw_matches_chip(const struct adapter *adap,
> 
>    s/int/bool/?
> 
> >+			      const struct fw_hdr *hdr)
> >+{
> >+	/* The expression below will return FALSE for any unsupported adapter
> >+	 * which will keep us "honest" in the future ...
> >+	 */
> >+	if ((is_t4(adap->params.chip) && hdr->chip == FW_HDR_CHIP_T4) ||
> >+	    (is_t5(adap->params.chip) && hdr->chip == FW_HDR_CHIP_T5))
> >+		return 1;
> 
>    s/1/true/?
> 
> >+
> >+	dev_err(adap->pdev_dev,
> >+		"FW image (%d) is not suitable for this adapter (%d)\n",
> >+		hdr->chip, CHELSIO_CHIP_VERSION(adap->params.chip));
> >+	return 0;
> 
>    s/0/false/?
> 
> [...]
> 
> WBR, Sergei
> 

Thanks for the review comment, have sent a V2 based on your comments.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ