[OpenWrt-Devel] [PATCH] base-files: fix get_mac_address not accepting hex offsets
Adrian Schmutzler
mail at adrianschmutzler.de
Thu Sep 5 07:21:31 EDT 2019
Hi David,
> -----Original Message-----
> From: David Bauer [mailto:mail at david-bauer.net]
> Sent: Mittwoch, 4. September 2019 23:07
> To: mail at adrianschmutzler.de
> Cc: openwrt-devel at lists.openwrt.org
> Subject: Re: [OpenWrt-Devel] [PATCH] base-files: fix get_mac_address not accepting hex offsets
>
> Hello Adrian,
>
> On 9/4/19 10:08 PM, mail at adrianschmutzler.de wrote:
> > when I tested it then, the hexdump offset did accept hexadecimal values intrinsically.
> > I remember that because I was quite surprised that offset accepted hexadecimal values and size didn't.
>
> This might be the case for hexdump, however dd does not accept hexadecimal values.
Indeed, I overlooked that one. So we have four cases:
1. mtd_get_mac_text:
This uses dd and should currently be broken, so it needs the $(($...)) as a fix.
2. get_mac_binary:
This one uses hexdump, so $(($...)) is not required, but might be added for convenience.
3. mtd_get_mac_binary:
This one is just calling get_mac_binary. I'd say that get_mac_binary should be safe to be called with hex offset, so I would not change to decimal _before_, so just keep this as it is.
4. mtd_get_mac_binary_ubi:
This could be treated similar to 2. However, on a closer look part of this function is the same as in get_mac_binary. So, IMO this one should be refactored to call get_mac_binary as in mtd_get_mac_binary.
Nevertheless, thanks for spotting and repairing the bug introduced in my patch!
Best
Adrian
>
> The commit message is indeed not correct in that regard. However I've changed the
> evaluation there too, as originally it was provided decimal numbers, keeping the
> underlying call stable.
>
> Best wishes
> David
-------------- 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/20190905/e079501d/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