clk: bcm: rpi: Assign ->num before accessing ->hws
In the Linux kernel, the following vulnerability has been resolved: clk: bcm: rpi: Assign ->num before accessing ->hws Commit f316cdff8d67 ("clk: Annotate struct clk_hw_onecell_data with __counted_by") annotated the hws member of 'struct clk_hw_onecell_data' with __counted_by, which informs the bounds sanitizer about the number of elements in hws, so that it can warn when hws is accessed out of bounds. As noted in that change, the __counted_by member must be initialized with the number of elements before the first array access happens, otherwise there will be a warning from each access prior to the initialization because the number of elements is zero. This occurs in raspberrypi_discover_clocks() due to ->num being assigned after ->hws has been accessed: UBSAN: array-index-out-of-bounds in drivers/clk/bcm/clk-raspberrypi.c:374:4 index 3 is out of range for type 'struct clk_hw *[] __counted_by(num)' (aka 'struct clk_hw *[]') Move the ->num initialization to before the first access of ->hws, which clears up the warning.
- Products
- Kernel
- Affected versions
- Not specified
- Fixed versions
- 6.6.34, 6.9.5
- CVEs
- CVE-2024-39461
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 8 Nov 2026, 00:42 UTC · Revision 1
Source evidence
clk: bcm: rpi: Assign ->num before accessing ->hws
core-osv · Original sourcePublished 25 Jun 2024, 14:25 UTC
In the Linux kernel, the following vulnerability has been resolved: clk: bcm: rpi: Assign ->num before accessing ->hws Commit f316cdff8d67 ("clk: Annotate struct clk_hw_onecell_data with __counted_by") annotated the hws member of 'struct clk_hw_onecell_data' with __counted_by, which informs the bounds sanitizer about the number of elements in hws, so that it can warn when hws is accessed out of bounds. As noted in that change, the __counted_by member must be initialized with the number of elements before the first array access happens, otherwise there will be a warning from each access prior to the initialization because the number of elements is zero. This occurs in raspberrypi_discover_clocks() due to ->num being assigned after ->hws has been accessed: UBSAN: array-index-out-of-bounds in drivers/clk/bcm/clk-raspberrypi.c:374:4 index 3 is out of range for type 'struct clk_hw *[] __counted_by(num)' (aka 'struct clk_hw *[]') Move the ->num initialization to before the first access of ->hws, which clears up the warning.
osv:CVE-2024-39461
Kernel
Fixed versions: 6.6.34, 6.9.5
Complete source record
{
"id": "8d6fcbb8e01b6e69cff4804ffd1c47af1dc0aa8e94bae9af0025363cd661ef9b",
"url": "https://osv.dev/vulnerability/CVE-2024-39461",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "clk: bcm: rpi: Assign ->num before accessing ->hws",
"summary": "In the Linux kernel, the following vulnerability has been resolved: clk: bcm: rpi: Assign ->num before accessing ->hws Commit f316cdff8d67 (\"clk: Annotate struct clk_hw_onecell_data with __counted_by\") annotated the hws member of 'struct clk_hw_onecell_data' with __counted_by, which informs the bounds sanitizer about the number of elements in hws, so that it can warn when hws is accessed out of bounds. As noted in that change, the __counted_by member must be initialized with the number of elements before the first array access happens, otherwise there will be a warning from each access prior to the initialization because the number of elements is zero. This occurs in raspberrypi_discover_clocks() due to ->num being assigned after ->hws has been accessed: UBSAN: array-index-out-of-bounds in drivers/clk/bcm/clk-raspberrypi.c:374:4 index 3 is out of range for type 'struct clk_hw *[] __counted_by(num)' (aka 'struct clk_hw *[]') Move the ->num initialization to before the first access of ->hws, which clears up the warning.",
"evidence": "osv:CVE-2024-39461",
"products": [
{
"name": {
"value": "Kernel",
"evidence": "/affected/1/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "6.6.34",
"evidence": "/affected/1/ranges"
},
{
"value": "6.9.5",
"evidence": "/affected/1/ranges"
}
],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "CVE-2024-39461",
"aliases": [
"CVE-2024-39461"
],
"affected": [
{
"ranges": [
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"type": "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"
}
},
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.6.0"
},
{
"fixed": "6.6.34"
}
]
},
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "6.7.0"
},
{
"fixed": "6.9.5"
}
]
}
],
"package": {
"name": "Kernel",
"ecosystem": "Linux"
},
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-39461.json"
}
}
],
"modified": "2026-10-28T02:30:52.536728187Z",
"provider": "osv",
"references": [
"https://git.kernel.org/stable/c/6dc445c1905096b2ed4db1a84570375b4e00cc0f",
"https://git.kernel.org/stable/c/9562dbe5cdbb16ac887d27ef6f179980bb99193c",
"https://git.kernel.org/stable/c/cdf9c7871d58d3df59d2775982e3533adb8ec920",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/39xxx/CVE-2024-39461.json",
"https://nvd.nist.gov/vuln/detail/CVE-2024-39461",
"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
],
"provider_metadata": {
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/39xxx/CVE-2024-39461.json"
}
},
"related_cves": [
{
"value": "CVE-2024-39461",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-osv",
"document_id": 521058,
"published_at": "2024-06-25T14:25:01.453+00:00"
}