{"id":"CVE-2024-42161","published":"2024-07-30T07:47:03Z","modified":"2026-05-11T20:28:10Z","title":"bpf: Avoid uninitialized value in BPF_CORE_READ_BITFIELD","vendor":"Linux","product":"Linux","tier":"tail","description":{"text":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Avoid uninitialized value in BPF_CORE_READ_BITFIELD\n\n[Changes from V1:\n - Use a default branch in the switch statement to initialize `val'.]\n\nGCC warns that `val' may be used uninitialized in the\nBPF_CRE_READ_BITFIELD macro, defined in bpf_core_read.h as:\n\n\t[...]\n\tunsigned long long val;\t\t\t\t\t\t      \\\n\t[...]\t\t\t\t\t\t\t\t      \\\n\tswitch (__CORE_RELO(s, field, BYTE_SIZE)) {\t\t\t      \\\n\tcase 1: val = *(const unsigned char *)p; break;\t\t\t      \\\n\tcase 2: val = *(const unsigned short *)p; break;\t\t      \\\n\tcase 4: val = *(const unsigned int *)p; break;\t\t\t      \\\n\tcase 8: val = *(const unsigned long long *)p; break;\t\t      \\\n        }       \t\t\t\t\t\t\t      \\\n\t[...]\n\tval;\t\t\t\t\t\t\t\t      \\\n\t}\t\t\t\t\t\t\t\t      \\\n\nThis patch adds a default entry in the switch statement that sets\n`val' to zero in order to avoid the warning, and random values to be\nused in case __builtin_preserve_field_info returns unexpected values\nfor BPF_FIELD_BYTE_SIZE.\n\nTested in bpf-next master.\nNo regressions.","provenance":"source","from":"CVE.org"},"cvss":null,"epss":{"score":0.0022,"percentile":0.12845,"provenance":"source"},"cwes":[],"references":[{"url":"https://git.kernel.org/stable/c/b694989bb13ed5f166e633faa1eb0f21c6d261a6","tags":[]},{"url":"https://git.kernel.org/stable/c/3364c2ed1c241989847f19cf83e3db903ce689e3","tags":[]},{"url":"https://git.kernel.org/stable/c/a21d76bd0b0d39518e9a4c19f6cf7c042a974aff","tags":[]},{"url":"https://git.kernel.org/stable/c/7e5471b5efebc30dd0bc035cda86693a5c73d45f","tags":[]},{"url":"https://git.kernel.org/stable/c/ff941a8449e712eaf7efca1a13bfb9afd3d99fc2","tags":[]},{"url":"https://git.kernel.org/stable/c/009367099eb61a4fc2af44d4eb06b6b4de7de6db","tags":[]},{"url":"https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html","tags":[]}],"priority":{"score":2.6,"factors":[{"name":"EPSS percentile","points":2.57}]},"vendorSlug":"linux","affectedVersions":[{"vendor":"Linux","product":"Linux","versions":[">= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, < b694989bb13ed5f166e633faa1eb0f21c6d261a6",">= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, < 3364c2ed1c241989847f19cf83e3db903ce689e3",">= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, < a21d76bd0b0d39518e9a4c19f6cf7c042a974aff",">= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, < 7e5471b5efebc30dd0bc035cda86693a5c73d45f",">= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, < ff941a8449e712eaf7efca1a13bfb9afd3d99fc2",">= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, < 009367099eb61a4fc2af44d4eb06b6b4de7de6db"]},{"vendor":"Linux","product":"Linux","versions":["5.5"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2024-09-10T16:14:52.496894Z","from":"CISA ADP","provenance":"source"},"euvd":{"id":"EUVD-2024-39992","exploited":false,"provenance":"source"}}