If chksum_offset in converted by $(($...)) at the beginning, the check [ -n "$chksum_offset" ] will always return true, as the conversion yields "0" for an empty argument.
With this patch, the variable is not converted before the check, but only when it's used in dd. No conversion is done for use in hexdump, as this can deal with hex values. Fixes: b133e466b08e ("treewide: convert WiFi caldata size and offset to hexadecimal") Signed-off-by: Adrian Schmutzler <freif...@adrianschmutzler.de> --- If this patchset is not accepted, one would have to fix this in the original positions anyway. --- package/base-files/files/lib/functions/caldata.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/lib/functions/caldata.sh b/package/base-files/files/lib/functions/caldata.sh index 1a1849b93f..6f605257bf 100644 --- a/package/base-files/files/lib/functions/caldata.sh +++ b/package/base-files/files/lib/functions/caldata.sh @@ -76,7 +76,7 @@ caldata_valid() { caldata_patch_fw_mac() { local mac=$1 local mac_offset=$(($2)) - local chksum_offset=$(($3)) + local chksum_offset=$3 local xor_mac local xor_fw_mac local xor_fw_chksum @@ -94,7 +94,7 @@ caldata_patch_fw_mac() { xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac) printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \ - dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2 + dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$(($chksum_offset)) count=2 } macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc oflag=seek_bytes bs=6 seek=$mac_offset count=1 || \ -- 2.20.1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel