Commit 4078c56
nfp: fix swapped arguments in nfp_encode_basic_qdr() calls
There is a mismatch between the passed arguments and the actual
nfp_encode_basic_qdr() function parameter names:
static int nfp_encode_basic_qdr(u64 addr, int dest_island, int cpp_tgt,
int mode, bool addr40, int isld1,
int isld0)
{
...
But "dest_island" and "cpp_tgt" are swapped at every call-site.
For example:
return nfp_encode_basic_qdr(*addr, cpp_tgt, dest_island,
mode, addr40, isld1, isld0);
As a result, nfp_encode_basic_qdr() receives "dest_island" as CPP target
type, which is always NFP_CPP_TARGET_QDR(2) for these calls, and "cpp_tgt"
as the destination island ID, which can accidentally match or be outside
the valid NFP_CPP_TARGET_* types (e.g. '-1' for any destination).
Since code already worked for years, also add extra pr_warn() to error
paths in nfp_encode_basic_qdr() to help identify any potential address
verification failures.
Detected using the static analysis tool - Svace.
Fixes: 4cb584e ("nfp: add CPP access core")
Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
Link: https://patch.msgid.link/20260422160536.61855-1-aleksei.kodanev@bell-sw.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 5a8db80 commit 4078c56
1 file changed
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
| 438 | + | |
| 439 | + | |
439 | 440 | | |
| 441 | + | |
440 | 442 | | |
441 | 443 | | |
442 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
443 | 447 | | |
| 448 | + | |
444 | 449 | | |
445 | 450 | | |
446 | 451 | | |
| |||
493 | 498 | | |
494 | 499 | | |
495 | 500 | | |
496 | | - | |
| 501 | + | |
497 | 502 | | |
498 | 503 | | |
499 | 504 | | |
| |||
504 | 509 | | |
505 | 510 | | |
506 | 511 | | |
507 | | - | |
| 512 | + | |
508 | 513 | | |
509 | 514 | | |
510 | 515 | | |
| |||
530 | 535 | | |
531 | 536 | | |
532 | 537 | | |
533 | | - | |
| 538 | + | |
534 | 539 | | |
535 | 540 | | |
536 | 541 | | |
| |||
551 | 556 | | |
552 | 557 | | |
553 | 558 | | |
554 | | - | |
| 559 | + | |
555 | 560 | | |
556 | 561 | | |
557 | 562 | | |
| |||
0 commit comments