In the Linux kernel, the following vulnerability has been resolved:
clk: bcm: dvp: Assign ->num before accessing ->hws
Commit f316cdff8d67 ("clk: Annotate struct clkhwonecelldata with _countedby") annotated the hws member of 'struct clkhwonecelldata' with _countedby, 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 _countedby 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 clkdvpprobe() due to ->num being assigned after ->hws has been accessed:
UBSAN: array-index-out-of-bounds in drivers/clk/bcm/clk-bcm2711-dvp.c:59:2 index 0 is out of range for type 'struct clkhw *[] _countedby(num)' (aka 'struct clkhw *[]')
Move the ->num initialization to before the first access of ->hws, which clears up the warning.
[
{
"signature_type": "Line",
"target": {
"file": "drivers/clk/bcm/clk-bcm2711-dvp.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0dc913217fb79096597005bba9ba738e2db5cd02",
"deprecated": false,
"id": "CVE-2024-39462-580d3093",
"signature_version": "v1",
"digest": {
"line_hashes": [
"338313242255175669823898800964851826523",
"271131221636875338899059488140976668608",
"171429801190507999582637033250929662541",
"215265476618152484616288124192293029332",
"94774563595580621174858485419273149380",
"169337286119513084587323991679316601807",
"179335528795556947924876998754968811522"
],
"threshold": 0.9
}
},
{
"signature_type": "Line",
"target": {
"file": "drivers/clk/bcm/clk-bcm2711-dvp.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1dd92fca0d6b58b55ed0484f75d4205dbb77010",
"deprecated": false,
"id": "CVE-2024-39462-72aa92de",
"signature_version": "v1",
"digest": {
"line_hashes": [
"338313242255175669823898800964851826523",
"271131221636875338899059488140976668608",
"171429801190507999582637033250929662541",
"215265476618152484616288124192293029332",
"94774563595580621174858485419273149380",
"169337286119513084587323991679316601807",
"179335528795556947924876998754968811522"
],
"threshold": 0.9
}
},
{
"signature_type": "Function",
"target": {
"function": "clk_dvp_probe",
"file": "drivers/clk/bcm/clk-bcm2711-dvp.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1dd92fca0d6b58b55ed0484f75d4205dbb77010",
"deprecated": false,
"id": "CVE-2024-39462-97069ae7",
"signature_version": "v1",
"digest": {
"length": 1618.0,
"function_hash": "67677365452061051875375359504997336856"
}
},
{
"signature_type": "Line",
"target": {
"file": "drivers/clk/bcm/clk-bcm2711-dvp.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9368cdf90f52a68120d039887ccff74ff33b4444",
"deprecated": false,
"id": "CVE-2024-39462-bab0c214",
"signature_version": "v1",
"digest": {
"line_hashes": [
"338313242255175669823898800964851826523",
"271131221636875338899059488140976668608",
"171429801190507999582637033250929662541",
"215265476618152484616288124192293029332",
"94774563595580621174858485419273149380",
"169337286119513084587323991679316601807",
"179335528795556947924876998754968811522"
],
"threshold": 0.9
}
},
{
"signature_type": "Function",
"target": {
"function": "clk_dvp_probe",
"file": "drivers/clk/bcm/clk-bcm2711-dvp.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9368cdf90f52a68120d039887ccff74ff33b4444",
"deprecated": false,
"id": "CVE-2024-39462-ce073b28",
"signature_version": "v1",
"digest": {
"length": 1618.0,
"function_hash": "67677365452061051875375359504997336856"
}
},
{
"signature_type": "Function",
"target": {
"function": "clk_dvp_probe",
"file": "drivers/clk/bcm/clk-bcm2711-dvp.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0dc913217fb79096597005bba9ba738e2db5cd02",
"deprecated": false,
"id": "CVE-2024-39462-f44cc7e7",
"signature_version": "v1",
"digest": {
"length": 1618.0,
"function_hash": "67677365452061051875375359504997336856"
}
}
]