diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-11-29 01:23:59 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-11-29 01:23:59 +0000 |
commit | de8a895d4b40b7a0e2cc355a9af31deb12a8a001 (patch) | |
tree | ed3f53ed427cd2d2f8ab65ed89774f38c18216c4 /sys | |
parent | d804c699c0c91251d3c417cfa24ca52cb57671d2 (diff) |
Fix a possible NULL pointer dereference. Spotted by Tobias Ulmer; thanks!
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 7f4fe148735..d36eed410f3 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -148,7 +148,8 @@ enum { #define DRM_AGP_MEM struct agp_memory_info /* D_CLONE only supports one device, this will be fixed eventually */ -#define drm_get_device_from_kdev(_kdev) drm_cd.cd_devs[0] +#define drm_get_device_from_kdev(_kdev) \ + (drm_cd.cd_ndevs > 0 ? drm_cd.cd_devs[0] : NULL) #if 0 #define drm_get_device_from_kdev(_kdev) \ (minor(_kdev) < drm_cd.cd_ndevs) ? drm_cd.cd_devs[minor(_kdev)] : NULL |