Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d29cc6ef authored by Dave Olson's avatar Dave Olson Committed by Roland Dreier
Browse files

IB/ipath: Future proof eeprom checksum code (contents reading)



In an earlier change, the amount of data read from the flash was
mistakenly limited to the size known to the current driver.  This causes
problems when the length is increased, and written with the new longer
version; the checksum would fail because not enough data was read.
Always read the full 128 byte length to prevent this.

Signed-off-by: default avatarDave Olson <dave.olson@qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 55046698
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -596,7 +596,11 @@ void ipath_get_eeprom_info(struct ipath_devdata *dd)
		goto bail;
		goto bail;
	}
	}


	len = offsetof(struct ipath_flash, if_future);
	/*
	 * read full flash, not just currently used part, since it may have
	 * been written with a newer definition
	 * */
	len = sizeof(struct ipath_flash);
	buf = vmalloc(len);
	buf = vmalloc(len);
	if (!buf) {
	if (!buf) {
		ipath_dev_err(dd, "Couldn't allocate memory to read %u "
		ipath_dev_err(dd, "Couldn't allocate memory to read %u "
@@ -737,8 +741,10 @@ int ipath_update_eeprom_log(struct ipath_devdata *dd)
	/*
	/*
	 * The quick-check above determined that there is something worthy
	 * The quick-check above determined that there is something worthy
	 * of logging, so get current contents and do a more detailed idea.
	 * of logging, so get current contents and do a more detailed idea.
	 * read full flash, not just currently used part, since it may have
	 * been written with a newer definition
	 */
	 */
	len = offsetof(struct ipath_flash, if_future);
	len = sizeof(struct ipath_flash);
	buf = vmalloc(len);
	buf = vmalloc(len);
	ret = 1;
	ret = 1;
	if (!buf) {
	if (!buf) {