diff options
author | Jakub Kicinski <kuba@kernel.org> | 2023-07-21 00:05:03 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-07-21 00:52:55 +0200 |
commit | 59be3baa8dff271d48500e009622318badfc7140 (patch) | |
tree | d7fde1af4197df9ece8ca26fb492051df2ef80f1 /tools/lib | |
parent | tcp: add TCP_OLD_SEQUENCE drop reason (diff) | |
parent | Merge tag 'net-6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netd... (diff) | |
download | linux-59be3baa8dff271d48500e009622318badfc7140.tar.xz linux-59be3baa8dff271d48500e009622318badfc7140.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR.
No conflicts or adjacent changes.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/subcmd/help.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tools/lib/subcmd/help.c b/tools/lib/subcmd/help.c index 67a8d6b740ea..adfbae27dc36 100644 --- a/tools/lib/subcmd/help.c +++ b/tools/lib/subcmd/help.c @@ -68,8 +68,13 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) while (ci < cmds->cnt && ei < excludes->cnt) { cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name); if (cmp < 0) { - zfree(&cmds->names[cj]); - cmds->names[cj++] = cmds->names[ci++]; + if (ci == cj) { + ci++; + cj++; + } else { + zfree(&cmds->names[cj]); + cmds->names[cj++] = cmds->names[ci++]; + } } else if (cmp == 0) { ci++; ei++; @@ -77,10 +82,11 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) ei++; } } - - while (ci < cmds->cnt) { - zfree(&cmds->names[cj]); - cmds->names[cj++] = cmds->names[ci++]; + if (ci != cj) { + while (ci < cmds->cnt) { + zfree(&cmds->names[cj]); + cmds->names[cj++] = cmds->names[ci++]; + } } for (ci = cj; ci < cmds->cnt; ci++) zfree(&cmds->names[ci]); |