diff options
author | Charles Longeau <chl@cvs.openbsd.org> | 2009-02-08 22:51:50 +0000 |
---|---|---|
committer | Charles Longeau <chl@cvs.openbsd.org> | 2009-02-08 22:51:50 +0000 |
commit | 66ce5e0f9276bf525fe8d19e94e2920d75782a56 (patch) | |
tree | 4cc50c1155cf6316eb4e2910c0857066909e70af /sys/dev/pci/drm | |
parent | 6f9eb15b0f26c3385e0d8b11084ef070d15d3f95 (diff) |
fix potential null dereferences.
Found by LLVM/Clang Static Analyzer.
ok oga@
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index d5d7d43185d..e948965dd93 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -452,6 +452,9 @@ drmclose(dev_t kdev, int flags, int fmt, struct proc *p) struct drm_file *file_priv; int retcode = 0; + if (dev == NULL) + return (ENXIO); + DRM_DEBUG("open_count = %d\n", dev->open_count); DRM_LOCK(); @@ -709,6 +712,9 @@ drmmmap(dev_t kdev, off_t offset, int prot) struct drm_file *priv; enum drm_map_type type; + if (dev == NULL) + return (-1); + DRM_LOCK(); priv = drm_find_file_by_minor(dev, minor(kdev)); DRM_UNLOCK(); |