{"id":"CVE-2024-39461","state":"PUBLISHED","title":"clk: bcm: rpi: Assign ->num before accessing ->hws","description":"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.","publishedAt":"2024-06-25T14:25:01.453Z","updatedAt":"2026-05-11T20:20:59.304Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"f316cdff8d677db9ad9c90acb44c4cd535b0ee27","status":"affected","lessThan":"9562dbe5cdbb16ac887d27ef6f179980bb99193c","versionType":"git"},{"version":"f316cdff8d677db9ad9c90acb44c4cd535b0ee27","status":"affected","lessThan":"cdf9c7871d58d3df59d2775982e3533adb8ec920","versionType":"git"},{"version":"f316cdff8d677db9ad9c90acb44c4cd535b0ee27","status":"affected","lessThan":"6dc445c1905096b2ed4db1a84570375b4e00cc0f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/clk/bcm/clk-raspberrypi.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.6","versionType":"semver"},{"version":"6.6.34","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.9.5","status":"unaffected","lessThanOrEqual":"6.9.*","versionType":"semver"},{"version":"6.10","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/clk/bcm/clk-raspberrypi.c"]}],"references":["https://git.kernel.org/stable/c/9562dbe5cdbb16ac887d27ef6f179980bb99193c","https://git.kernel.org/stable/c/cdf9c7871d58d3df59d2775982e3533adb8ec920","https://git.kernel.org/stable/c/6dc445c1905096b2ed4db1a84570375b4e00cc0f"],"weaknesses":[],"ingestedAt":"2026-10-29T20:07:39.287Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2024/39xxx/CVE-2024-39461.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-39461","state":"PUBLISHED","datePublished":"2024-06-25T14:25:01.453Z","dateUpdated":"2026-05-11T20:20:59.304Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-06-25T14:23:23.743Z"},"containers":{"cna":{"title":"clk: bcm: rpi: Assign ->num before accessing ->hws","descriptions":[{"lang":"en","value":"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."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"f316cdff8d677db9ad9c90acb44c4cd535b0ee27","status":"affected","lessThan":"9562dbe5cdbb16ac887d27ef6f179980bb99193c","versionType":"git"},{"version":"f316cdff8d677db9ad9c90acb44c4cd535b0ee27","status":"affected","lessThan":"cdf9c7871d58d3df59d2775982e3533adb8ec920","versionType":"git"},{"version":"f316cdff8d677db9ad9c90acb44c4cd535b0ee27","status":"affected","lessThan":"6dc445c1905096b2ed4db1a84570375b4e00cc0f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/clk/bcm/clk-raspberrypi.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.6","versionType":"semver"},{"version":"6.6.34","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.9.5","status":"unaffected","lessThanOrEqual":"6.9.*","versionType":"semver"},{"version":"6.10","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/clk/bcm/clk-raspberrypi.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/9562dbe5cdbb16ac887d27ef6f179980bb99193c"},{"url":"https://git.kernel.org/stable/c/cdf9c7871d58d3df59d2775982e3533adb8ec920"},{"url":"https://git.kernel.org/stable/c/6dc445c1905096b2ed4db1a84570375b4e00cc0f"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-05-11T20:20:59.304Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.6.34"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.9.5"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6","versionEndExcluding":"6.10"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/9562dbe5cdbb16ac887d27ef6f179980bb99193c","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/cdf9c7871d58d3df59d2775982e3533adb8ec920","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/6dc445c1905096b2ed4db1a84570375b4e00cc0f","tags":["x_transferred"]}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2024-08-02T04:26:14.267Z"}},{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2024-39461","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2024-09-10T17:08:08.266580Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2024-09-11T17:34:42.350Z"}}]}}}