-
Notifications
You must be signed in to change notification settings - Fork 97
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
bpf: avoid uninitialized value in BPF_CORE_READ_BITFIELD #6986
Conversation
Upstream branch: 329a672 |
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=851141 expired. Closing PR. |
Upstream branch: 7e2c7a3 |
63559bf
to
81ededa
Compare
606f72a
to
041b1be
Compare
Upstream branch: e612b5c |
81ededa
to
066d65c
Compare
041b1be
to
63334d2
Compare
[Changes from V1: - Use a default branch in the switch statement to initialize `val'.] GCC warns that `val' may be used uninitialized in the BPF_CRE_READ_BITFIELD macro, defined in bpf_core_read.h as: [...] unsigned long long val; \ [...] \ switch (__CORE_RELO(s, field, BYTE_SIZE)) { \ case 1: val = *(const unsigned char *)p; break; \ case 2: val = *(const unsigned short *)p; break; \ case 4: val = *(const unsigned int *)p; break; \ case 8: val = *(const unsigned long long *)p; break; \ } \ [...] val; \ } \ This patch adds a default entry in the switch statement that sets `val' to zero in order to avoid the warning, and random values to be used in case __builtin_preserve_field_info returns unexpected values for BPF_FIELD_BYTE_SIZE. Tested in bpf-next master. No regressions. Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com> Cc: david.faust@oracle.com Cc: cupertino.miranda@oracle.com Cc: Eduard Zingerman <eddyz87@gmail.com> Cc: Yonghong Song <yonghong.song@linux.dev> Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Upstream branch: 911edc6 |
066d65c
to
77d88fe
Compare
63334d2
to
2a4c29b
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=851511 irrelevant now. Closing PR. |
Pull request for series with
subject: bpf: avoid uninitialized value in BPF_CORE_READ_BITFIELD
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=851141