{"id":"CVE-2024-39461","summary":"clk: bcm: rpi: Assign -\u003enum before accessing -\u003ehws","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nclk: bcm: rpi: Assign -\u003enum before accessing -\u003ehws\n\nCommit f316cdff8d67 (\"clk: Annotate struct clk_hw_onecell_data with\n__counted_by\") annotated the hws member of 'struct clk_hw_onecell_data'\nwith __counted_by, which informs the bounds sanitizer about the number\nof elements in hws, so that it can warn when hws is accessed out of\nbounds. As noted in that change, the __counted_by member must be\ninitialized with the number of elements before the first array access\nhappens, otherwise there will be a warning from each access prior to the\ninitialization because the number of elements is zero. This occurs in\nraspberrypi_discover_clocks() due to -\u003enum being assigned after -\u003ehws\nhas been accessed:\n\n  UBSAN: array-index-out-of-bounds in drivers/clk/bcm/clk-raspberrypi.c:374:4\n  index 3 is out of range for type 'struct clk_hw *[] __counted_by(num)' (aka 'struct clk_hw *[]')\n\nMove the -\u003enum initialization to before the first access of -\u003ehws, which\nclears up the warning.","modified":"2026-04-16T04:41:02.139973399Z","published":"2024-06-25T14:25:01.453Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/39xxx/CVE-2024-39461.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/6dc445c1905096b2ed4db1a84570375b4e00cc0f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/9562dbe5cdbb16ac887d27ef6f179980bb99193c"},{"type":"WEB","url":"https://git.kernel.org/stable/c/cdf9c7871d58d3df59d2775982e3533adb8ec920"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/39xxx/CVE-2024-39461.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-39461"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"f316cdff8d677db9ad9c90acb44c4cd535b0ee27"},{"fixed":"9562dbe5cdbb16ac887d27ef6f179980bb99193c"},{"fixed":"cdf9c7871d58d3df59d2775982e3533adb8ec920"},{"fixed":"6dc445c1905096b2ed4db1a84570375b4e00cc0f"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-39461.json"}}],"schema_version":"1.7.5"}