{"id":"CVE-2024-39461","published":"2024-06-25T14:25:01Z","modified":"2026-05-11T20:20:59Z","title":"clk: bcm: rpi: Assign ->num before accessing ->hws","vendor":"Linux","product":"Linux","tier":"tail","description":{"text":"In the Linux kernel, the following vulnerability has been resolved:\n\nclk: bcm: rpi: Assign ->num before accessing ->hws\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 ->num being assigned after ->hws\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 ->num initialization to before the first access of ->hws, which\nclears up the warning.","provenance":"source","from":"CVE.org"},"cvss":null,"epss":{"score":0.00211,"percentile":0.1164,"provenance":"source"},"cwes":[],"references":[{"url":"https://git.kernel.org/stable/c/9562dbe5cdbb16ac887d27ef6f179980bb99193c","tags":[]},{"url":"https://git.kernel.org/stable/c/cdf9c7871d58d3df59d2775982e3533adb8ec920","tags":[]},{"url":"https://git.kernel.org/stable/c/6dc445c1905096b2ed4db1a84570375b4e00cc0f","tags":[]}],"priority":{"score":2.3,"factors":[{"name":"EPSS percentile","points":2.33}]},"vendorSlug":"linux","affectedVersions":[{"vendor":"Linux","product":"Linux","versions":[">= f316cdff8d677db9ad9c90acb44c4cd535b0ee27, < 9562dbe5cdbb16ac887d27ef6f179980bb99193c",">= f316cdff8d677db9ad9c90acb44c4cd535b0ee27, < cdf9c7871d58d3df59d2775982e3533adb8ec920",">= f316cdff8d677db9ad9c90acb44c4cd535b0ee27, < 6dc445c1905096b2ed4db1a84570375b4e00cc0f"]},{"vendor":"Linux","product":"Linux","versions":["6.6"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2024-09-10T17:08:08.266580Z","from":"CISA ADP","provenance":"source"},"euvd":{"id":"EUVD-2024-37986","exploited":false,"provenance":"source"}}