summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-05-20 05:03:01 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-05-20 05:03:01 +0000
commit72288aa0b562a24d8680264a35425610449ef81b (patch)
tree974ac417609d6a134d8c2c616c1d48a6b637bae1 /sys
parentd223ce83b50b1d4c8c5a1ac354ca4832e469e0d8 (diff)
drm/radeon: silence UBSAN warning (v3)
From Alex Deucher aff9dba5e8cedddb32759e835304697661ccf3f1 in linux-6.6.y/6.6.31 781d41fed19caf900c8405064676813dc9921d32 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/radeon/pptable.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/pci/drm/radeon/pptable.h b/sys/dev/pci/drm/radeon/pptable.h
index 4c2eec49dad..844f0490bf3 100644
--- a/sys/dev/pci/drm/radeon/pptable.h
+++ b/sys/dev/pci/drm/radeon/pptable.h
@@ -424,7 +424,7 @@ typedef struct _ATOM_PPLIB_SUMO_CLOCK_INFO{
typedef struct _ATOM_PPLIB_STATE_V2
{
//number of valid dpm levels in this state; Driver uses it to calculate the whole
- //size of the state: sizeof(ATOM_PPLIB_STATE_V2) + (ucNumDPMLevels - 1) * sizeof(UCHAR)
+ //size of the state: struct_size(ATOM_PPLIB_STATE_V2, clockInfoIndex, ucNumDPMLevels)
UCHAR ucNumDPMLevels;
//a index to the array of nonClockInfos
@@ -432,14 +432,14 @@ typedef struct _ATOM_PPLIB_STATE_V2
/**
* Driver will read the first ucNumDPMLevels in this array
*/
- UCHAR clockInfoIndex[1];
+ UCHAR clockInfoIndex[] __counted_by(ucNumDPMLevels);
} ATOM_PPLIB_STATE_V2;
typedef struct _StateArray{
//how many states we have
UCHAR ucNumEntries;
- ATOM_PPLIB_STATE_V2 states[1];
+ ATOM_PPLIB_STATE_V2 states[] __counted_by(ucNumEntries);
}StateArray;
@@ -450,7 +450,7 @@ typedef struct _ClockInfoArray{
//sizeof(ATOM_PPLIB_CLOCK_INFO)
UCHAR ucEntrySize;
- UCHAR clockInfo[1];
+ UCHAR clockInfo[] __counted_by(ucNumEntries);
}ClockInfoArray;
typedef struct _NonClockInfoArray{
@@ -460,7 +460,7 @@ typedef struct _NonClockInfoArray{
//sizeof(ATOM_PPLIB_NONCLOCK_INFO)
UCHAR ucEntrySize;
- ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[1];
+ ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[] __counted_by(ucNumEntries);
}NonClockInfoArray;
typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Record