Skip to content

bpftool: fix a bug in subskeleton code generation #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

kernel-patches-bot
Copy link

Pull request for series with
subject: bpftool: fix a bug in subskeleton code generation
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920

@kernel-patches-bot
Copy link
Author

Master branch: 9492450
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: a8fee96
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 46e9244
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: ef07860
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 7ada378
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: ec80906
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: f709869
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: d0f325c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: d8dc09a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: d56c9fe
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: e581094
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=624920
version: 1

Compiled with clang by adding LLVM=1 both kernel and selftests/bpf
build, I hit the following compilation error:

In file included from /.../tools/testing/selftests/bpf/prog_tests/subskeleton.c:6:
  ./test_subskeleton_lib.subskel.h:168:6: error: variable 'err' is used uninitialized whenever
      'if' condition is true [-Werror,-Wsometimes-uninitialized]
          if (!s->progs)
              ^~~~~~~~~
  ./test_subskeleton_lib.subskel.h:181:11: note: uninitialized use occurs here
          errno = -err;
                   ^~~
  ./test_subskeleton_lib.subskel.h:168:2: note: remove the 'if' if its condition is always false
          if (!s->progs)
          ^~~~~~~~~~~~~~

The compilation error is triggered by the following code
        ...
        int err;

        obj = (struct test_subskeleton_lib *)calloc(1, sizeof(*obj));
        if (!obj) {
                errno = ENOMEM;
                goto err;
        }
        ...

  err:
        test_subskeleton_lib__destroy(obj);
        errno = -err;
        ...
in test_subskeleton_lib__open(). The 'err' is not initialized, yet it
is used in 'errno = -err' later.

The fix is to remove 'errno = -err' since errno has been set properly
in all incoming branches.

Cc: Delyan Kratunov <[email protected]>
Fixes: 00389c5 ("00389c58ffe993782a8ba4bb5a34a102b1f6fe24")
Signed-off-by: Yonghong Song <[email protected]>
@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=624920 irrelevant now. Closing PR.

@kernel-patches-bot kernel-patches-bot deleted the series/624920=>bpf-next branch March 21, 2022 21:52
kernel-patches-bot pushed a commit that referenced this pull request Oct 4, 2022
Add a big batch of selftest to extend test_progs with various tc link,
attach ops and old-style tc BPF attachments via libbpf APIs. Also test
multi-program attachments including mixing the various attach options:

  # ./test_progs -t tc_link
  #179     tc_link_base:OK
  #180     tc_link_detach:OK
  #181     tc_link_mix:OK
  #182     tc_link_opts:OK
  #183     tc_link_run_base:OK
  #184     tc_link_run_chain:OK
  Summary: 6/0 PASSED, 0 SKIPPED, 0 FAILED

All new and existing test cases pass.

Co-developed-by: Nikolay Aleksandrov <[email protected]>
Signed-off-by: Nikolay Aleksandrov <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants