[OpenWrt-Devel] Negative offset for checksum in ath79's 10-ath9k-eeprom

Adrian Schmutzler mail at adrianschmutzler.de
Wed Sep 18 08:18:07 EDT 2019


Hi,

I've encountered the following issue, for which I would like a second opinion.

In ath79's 10-ath9k-eeprom, in addition to patching the firmware MAC address, some devices also need a checksum adjustment:
https://github.com/openwrt/openwrt/blob/master/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom#L60

For this purpose, the function ath9k_patch_fw_mac_crc is used (below ath9k_patch_fw_mac), where the chksum_offset is calculated by subtracting 10 from the mac_offset.
(For ath10k chksum_offset value is hardcoded to 2).

However, in ath79's 10-ath9k-eeprom, some devices call this function with a mac_offset of 0x2, e.g.

dlink,dir-825-c1|\
dlink,dir-835-a1)
	ath9k_eeprom_extract "art" 0x1000 0x440
	ath9k_patch_fw_mac_crc $(mtd_get_mac_text "mac" 0x4) 0x2

This would result in a negative chksum_offset.

To me this looks like a misuse of ath9k_patch_fw_mac_crc where ath9k_patch_fw_mac should have been used.
Or does anyone see a reason for this?
(I've added the device support authors in Cc)

If not, I would send the following fixes:
- Change ath9k_patch_fw_mac_crc to ath9k_patch_fw_mac for the relevant cases
- Add a check for negative values of chksum_offset and display a warning

List of affected devices:
dlink,dir-825-c1
dlink,dir-835-a1
wd,mynet-wifi-rangeextender

Best

Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20190918/ab9c9981/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list