Re: [RFC PATCH 1/2] net: ethtool: Add capability to retrieveplug-in module EEPROM

From: Ben Hutchings
Date: Mon Apr 02 2012 - 14:14:40 EST


On Mon, 2012-04-02 at 18:52 +0100, Ben Hutchings wrote:
[...]
> > + ret = ops->get_module_eeprom(dev, &eeprom, data);
> > + if (ret)
> > + goto out;
> > +
> > +
> > + if (copy_to_user(userbuf, data, eeprom.len)) {
> > + ret = -EFAULT;
> > + goto out;
> > + }
> > +
> > + if (copy_to_user(useraddr, &eeprom, sizeof(eeprom)))
> > + ret = -EFAULT;
> [...]
>
> I think you can drop this last copy as there's no information to return
> in the eeprom structure itself.
[...]

This is not the case because we need to cover short reads.

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 linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/