diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-03-13 21:31:57 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-03-13 21:31:57 +0100 |
commit | 389c55db14fedd949f063d3109548c643c52dfd6 (patch) | |
tree | e16387850c5615e609d7fd0a9a7dc037bcddf8ed /device | |
parent | 687932bd14a38ae5f7fffe6f64d91d4a32fe4381 (diff) | |
download | gnumach-389c55db14fedd949f063d3109548c643c52dfd6.tar.gz gnumach-389c55db14fedd949f063d3109548c643c52dfd6.tar.bz2 gnumach-389c55db14fedd949f063d3109548c643c52dfd6.zip |
device: Fix NULL dereference
Diffstat (limited to 'device')
-rw-r--r-- | device/ds_routines.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/device/ds_routines.c b/device/ds_routines.c index b485fa6d..c883aec7 100644 --- a/device/ds_routines.c +++ b/device/ds_routines.c @@ -329,12 +329,14 @@ ds_device_intr_register (device_t dev, int id, return D_INVALID_OPERATION; #else /* MACH_XEN || __x86_64__ */ kern_return_t err; - mach_device_t mdev = dev->emul_data; + mach_device_t mdev; /* Refuse if device is dead or not completely open. */ if (dev == DEVICE_NULL) return D_NO_SUCH_DEVICE; + mdev = dev->emul_data; + /* No flag is defined for now */ if (flags != 0) return D_INVALID_OPERATION; @@ -366,13 +368,15 @@ ds_device_intr_ack (device_t dev, ipc_port_t receive_port) #if defined(MACH_XEN) || defined(__x86_64__) return D_INVALID_OPERATION; #else /* MACH_XEN || __x86_64__ */ - mach_device_t mdev = dev->emul_data; + mach_device_t mdev; kern_return_t ret; /* Refuse if device is dead or not completely open. */ if (dev == DEVICE_NULL) return D_NO_SUCH_DEVICE; + mdev = dev->emul_data; + /* Must be called on the irq device only */ if (! name_equal(mdev->dev_ops->d_name, 3, "irq")) return D_INVALID_OPERATION; |