[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1361312048.2967.44.camel@bwh-desktop.uk.solarflarecom.com>
Date: Tue, 19 Feb 2013 22:14:08 +0000
From: Ben Hutchings <bhutchings@...arflare.com>
To: Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
Aurélien Guillaume <footplus@...il.com>
CC: <davem@...emloft.net>, <netdev@...r.kernel.org>,
<gospo@...hat.com>, <sassmann@...hat.com>,
Emil Tantilov <emil.s.tantilov@...el.com>
Subject: Re: [net-next 13/15] ixgbe: implement SFF diagnostic monitoring via
ethtool
On Sat, 2013-02-16 at 00:33 -0800, Jeff Kirsher wrote:
> From: Aurélien Guillaume <footplus@...il.com>
>
> This patch adds support for reading data from SFP+ modules over i2c.
[...]
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
[...]
> +static int ixgbe_get_module_eeprom(struct net_device *dev,
> + struct ethtool_eeprom *ee,
> + u8 *data)
> +{
> + struct ixgbe_adapter *adapter = netdev_priv(dev);
> + struct ixgbe_hw *hw = &adapter->hw;
> + u32 status = IXGBE_ERR_PHY_ADDR_INVALID;
> + u8 databyte = 0xFF;
> + int i = 0;
> + int ret_val = 0;
> +
> + /* ixgbe_get_module_info is called before this function in all
> + * cases, so we do not need any checks we already do above,
> + * and can trust ee->len to be a known value.
> + */
[...]
Whatever makes you think that?
All you are guaranteed is that:
ee->offset <= ee->offset + ee->len <= eeprom_len
Same as for the regular EEPROM read function.
This implementation doesn't result in a heap overrun at present because
the caller allocates a whole page as a buffer. But you should not
assume that it's safe to write more than ee->len bytes, nor that
ee->offset == 0.
Ben.
--
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.
--
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