Skip to content

Commit 6ad33b5

Browse files
GustavoARSilvakees
authored andcommitted
nouveau/svm: Replace one-element array with flexible-array member in struct nouveau_svm
One-element and zero-length arrays are deprecated. So, replace one-element array in struct nouveau_svm with flexible-array member. This results in no differences in binary output. Link: KSPP#338 Signed-off-by: "Gustavo A. R. Silva" <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/087a1c335228bd245192bbb2fb347c9af1be5750.1692208802.git.gustavoars@kernel.org Signed-off-by: Kees Cook <[email protected]>
1 parent 4ae7f63 commit 6ad33b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/nouveau/nouveau_svm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct nouveau_svm {
6767
struct nouveau_svmm *svmm;
6868
} **fault;
6969
int fault_nr;
70-
} buffer[1];
70+
} buffer[];
7171
};
7272

7373
#define FAULT_ACCESS_READ 0
@@ -1063,7 +1063,7 @@ nouveau_svm_init(struct nouveau_drm *drm)
10631063
if (drm->client.device.info.family > NV_DEVICE_INFO_V0_PASCAL)
10641064
return;
10651065

1066-
if (!(drm->svm = svm = kzalloc(sizeof(*drm->svm), GFP_KERNEL)))
1066+
if (!(drm->svm = svm = kzalloc(struct_size(drm->svm, buffer, 1), GFP_KERNEL)))
10671067
return;
10681068

10691069
drm->svm->drm = drm;

0 commit comments

Comments
 (0)