Skip to content

Commit bbee049

Browse files
tititiou36awilliam
authored andcommitted
kvm/vfio: Constify struct kvm_device_ops
'struct kvm_device_ops' is not modified in this driver. Constifying this structure moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 2605 169 16 2790 ae6 virt/kvm/vfio.o After: ===== text data bss dec hex filename 2685 89 16 2790 ae6 virt/kvm/vfio.o Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/e7361a1bb7defbb0f7056b884e83f8d75ac9fe21.1727517084.git.christophe.jaillet@wanadoo.fr Signed-off-by: Alex Williamson <[email protected]>
1 parent 8198375 commit bbee049

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

virt/kvm/vfio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static void kvm_vfio_release(struct kvm_device *dev)
353353

354354
static int kvm_vfio_create(struct kvm_device *dev, u32 type);
355355

356-
static struct kvm_device_ops kvm_vfio_ops = {
356+
static const struct kvm_device_ops kvm_vfio_ops = {
357357
.name = "kvm-vfio",
358358
.create = kvm_vfio_create,
359359
.release = kvm_vfio_release,

0 commit comments

Comments
 (0)