Messages in this thread | | | Subject | Re: [RFC PATCH 1/2] net: ethtool: Add capability to retrieve plug-in module EEPROM | From | Ben Hutchings <> | Date | Wed, 11 Apr 2012 19:16:57 +0100 |
| |
On Wed, 2012-04-11 at 17:50 +0100, Stuart Hodgson wrote: > On 02/04/12 18:52, Ben Hutchings wrote: [...] > >> --- a/net/core/ethtool.c > >> +++ b/net/core/ethtool.c [...] > >> + if (eeprom.offset + eeprom.len> modinfo.eeprom_len) > >> + return -EINVAL; > >> + > >> + data = kmalloc(PAGE_SIZE, GFP_USER); > >> + if (!data) > >> + return -ENOMEM; > > > > What if some device has a larger EEPROM? Surely this length should be > > eeprom.len. > > > > Do you mean what if the eeprom length in te device is larger than > PAGE_SIZE?
Yes.
> If so then it should really use modinfo.eeprom_len since > this the size of the data. eeprom.len could be arbitary.
No, eeprom.len is the size of the data and we've already validated it at this point.
Ben.
| |