Re: [PATCH] ntb: ntb_tool: accept hexadecimal addresses in peer_mw_trans again

From: Oğuzhan Kaynak

Date: Fri Nov 27 2026 - 10:49:22 EST


Koichiro Den <den@xxxxxxxxxxxxx>, 27 Kas 2026 Cum, 11:01 tarihinde şunu yazdı:
>
> On Thu, Nov 26, 2026 at 06:15:06AM +0300, Oguzhan KAYNAK wrote:
> > - n = sscanf(buf, "%llu:%zu", &addr, &wsize);
> > + n = sscanf(buf, "%lli:%zu", &addr, &wsize);
>
> Just to clarify, do we have any rule about negative values for the address part,
> like in "-1:4096"? 21fbdc4d0b1e mentions "-1" as a possible input for the size
> part, but doesn't mention it for the address part. (For either part, "-1" is
> really odd, but that's not the point.) As you mention, your patch starts
> accepting it for the address part again. Perhaps we should keep rejecting it
> there?
>
> If so, to cover the cases broguht up so far, perhaps it would be an option to
> split the input at ":" with strsep() and use kstrtou64() with base 0 for the
> address?

Good point, thanks. A negative address was rejected before my patch,
so it should stay that way. v2 does what you suggested: strsep() at ':'
and kstrtou64() with base 0 for the address. I did not carry your
Reviewed-by over, since the code changed.

v2: https://lore.kernel.org/all/20261127154157.3541-1-kaynak.oguzhan0@xxxxxxxxx/

Oguzhan