On Fri, 13 Nov 2026 17:28:23 +0300
Bulatov Mark <[email protected]> wrote:
> The function nfp_encode_basic_qdr() takes cpp_tgt as its second argument
> and dest_island as its third. However, the implementation of this function
> implies the opposite: dest_island should be the second argument, and
> cpp_tgt the third.
>
> Furthermore, the implementation compares the second argument against a
> negative value, whereas the cpp_tgt parameter — as defined in the
> nfp_target.h header file—consists of a set of values that does not
> include any negative numbers. The situation is exactly the reverse for
> the nfp_decode_basic() function, which receives a value for which these
> definitions are not entirely appropriate.
>
> Fix this by swapping the arguments.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: e6858e7e7c ("net/nfp: move shared target logic to own file")
> Cc: [email protected]
>
> Signed-off-by: Mark Bulatov <[email protected]>
> ---
Several issues need fixing from AI review.
[PATCH] net/nfp: fix wrong argument order in nfp_encode_basic
The fix is correct. nfp_encode_basic_qdr() is declared as
(addr, dest_island, cpp_tgt, ...) and all four callers pass
(addr, cpp_tgt, dest_island, ...). With the swap, decode skipped the
MU/CT_XPB guard on the real target and the final compare checked the
decoded island against NFP_CPP_TARGET_QDR (2) instead of dest_island,
so QDR encoding failed with -EINVAL unless the island happened to be 2.
Warning: Author does not match Signed-off-by.
The patch has no "From: Mark Bulatov" line in the body, so git am
records the author as "Bulatov Mark" while the Signed-off-by is
"Mark Bulatov". The first patch has the body From: line; this one
needs it too, or fix user.name so the header is right.
Warning: Commit message contains non-ASCII characters: two em-dashes
and two zero-width spaces (U+200B) in "values that". The second
paragraph is also hard to follow. Suggest:
nfp_encode_basic_qdr() takes dest_island as its second argument
and cpp_tgt as its third, but all callers in nfp_encode_basic()
pass them in the opposite order. As a result nfp_decode_basic()
gets the island ID as the target, and the island check compares
against NFP_CPP_TARGET_QDR instead of the requested island.
Swap the arguments.
Warning: Fixes tag needs a 12 character hash:
Fixes: e6858e7e7cd3 ("net/nfp: move shared target logic to own file")