You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-emulation/vmware-modules/files/308-hardened.patch

90 lines
2.9 KiB

diff --git a/vmmon-only/linux/driver.c b/vmmon-only/linux/driver.c
index b21dd44..960c2aa 100644
--- a/vmmon-only/linux/driver.c
+++ b/vmmon-only/linux/driver.c
@@ -178,7 +178,16 @@ static struct vm_operations_struct vmuser_mops = {
#endif
};
-static struct file_operations vmuser_fops;
+static struct file_operations vmuser_fops = {
+ .owner = THIS_MODULE,
+ .poll = LinuxDriverPoll,
+ .unlocked_ioctl = LinuxDriver_Ioctl,
+ .compat_ioctl = LinuxDriver_Ioctl,
+ .open = LinuxDriver_Open,
+ .release = LinuxDriver_Close,
+ .mmap = LinuxDriverMmap
+};
+
static struct timer_list tscTimer;
static Atomic_uint32 tsckHz;
static VmTimeStart tsckHzStartTime;
@@ -357,21 +372,6 @@ init_module(void)
linuxState.fastClockPriority = -20;
linuxState.swapSize = VMMON_UNKNOWN_SWAP_SIZE;
- /*
- * Initialize the file_operations structure. Because this code is always
- * compiled as a module, this is fine to do it here and not in a static
- * initializer.
- */
-
- memset(&vmuser_fops, 0, sizeof vmuser_fops);
- vmuser_fops.owner = THIS_MODULE;
- vmuser_fops.poll = LinuxDriverPoll;
- vmuser_fops.unlocked_ioctl = LinuxDriver_Ioctl;
- vmuser_fops.compat_ioctl = LinuxDriver_Ioctl;
- vmuser_fops.open = LinuxDriver_Open;
- vmuser_fops.release = LinuxDriver_Close;
- vmuser_fops.mmap = LinuxDriverMmap;
-
#ifdef VMX86_DEVEL
devel_init_module();
linuxState.minor = 0;
diff --git a/vmnet-only/driver.c b/vmnet-only/driver.c
index b12b982..40bd4cf 100644
--- a/vmnet-only/driver.c
+++ b/vmnet-only/driver.c
@@ -165,7 +165,16 @@ static long VNetFileOpUnlockedIoctl(struct file * filp,
unsigned int iocmd, unsigned long ioarg);
#endif
-static struct file_operations vnetFileOps;
+static struct file_operations vnetFileOps = {
+ .owner = THIS_MODULE,
+ .read = VNetFileOpRead,
+ .write = VNetFileOpWrite,
+ .poll = VNetFileOpPoll,
+ .unlocked_ioctl = VNetFileOpUnlockedIoctl,
+ .compat_ioctl = VNetFileOpUnlockedIoctl,
+ .open = VNetFileOpOpen,
+ .release = VNetFileOpClose
+};
/*
* Utility functions
@@ -476,22 +491,6 @@ init_module(void)
goto err_proto;
}
- /*
- * Initialize the file_operations structure. Because this code is always
- * compiled as a module, this is fine to do it here and not in a static
- * initializer.
- */
-
- memset(&vnetFileOps, 0, sizeof vnetFileOps);
- vnetFileOps.owner = THIS_MODULE;
- vnetFileOps.read = VNetFileOpRead;
- vnetFileOps.write = VNetFileOpWrite;
- vnetFileOps.poll = VNetFileOpPoll;
- vnetFileOps.unlocked_ioctl = VNetFileOpUnlockedIoctl;
- vnetFileOps.compat_ioctl = VNetFileOpUnlockedIoctl;
- vnetFileOps.open = VNetFileOpOpen;
- vnetFileOps.release = VNetFileOpClose;
-
retval = register_chrdev(VNET_MAJOR_NUMBER, "vmnet", &vnetFileOps);
if (retval) {
LOG(0, (KERN_NOTICE "/dev/vmnet: could not register major device %d\n",