Re: [PATCH v2] ntb: ntb_tool: accept hexadecimal addresses in peer_mw_trans again
From: Oğuzhan Kaynak
Date: Mon Nov 30 2026 - 11:02:57 EST
On Sun, Nov 30, 2026, Koichiro Den wrote:
> With v2, "0x1000:0x1000" now just clears the MW and returns success.
> Shouldn't that only happen when the whole size field really represents zero
> (e.g. "0x1000:0")?
Yes, the size is still parsed with %zu there, which stops at the 'x'.
> My first thought was to use kstrtou64(.., 0, ..) for both fields. But should
> "010" mean 8 or 10? Looking into it, it seems that "010:010" was (8, 8) before
> 21fbdc4d0b1e, is (10, 10) on mainline, and would be (8, 10) with v2.. :(
>
> I think the choice of base is the maintainer's call, but AFAIC it would be nice
> to document whichever rule we settle on.
Thanks, good catch. Unless Jon prefers otherwise, I'd use base 0 for both
fields in v3 (kstrtou64() for the address, kstrtoul() for the size): that
is what "%lli:%zi" did before 21fbdc4d0b1e, so "010:010" would be (8, 8)
again, and it matches every other number ntb_tool parses (kstrto*() with
base 0, or %lli). Trailing garbage would be rejected in both fields, so
"0x1000:0x1000" maps 0x1000 bytes and only a real zero unmaps, and I'd
document the rule next to the usage example at the top of ntb_tool.c.
I'll send v3 in a couple of days if there are no objections.
Best regards,
Oguzhan