diff options
| author | 2008-07-29 19:44:13 +0000 | |
|---|---|---|
| committer | 2008-07-29 19:44:13 +0000 | |
| commit | f81a8921f7efd2dd19a840236e2e71b0289384f4 (patch) | |
| tree | 18bcad4d38d906e09981c7998f8438fa2cb4babb /sys/dev/pci/drm/drm_auth.c | |
| parent | Split SHA1Transform() back into smaller pieces when compiling on landisk, (diff) | |
| download | wireguard-openbsd-f81a8921f7efd2dd19a840236e2e71b0289384f4.tar.xz wireguard-openbsd-f81a8921f7efd2dd19a840236e2e71b0289384f4.zip | |
Switch all instances of malloc/free in the DRM to drm_alloc, drm_free
and drm_calloc.
With the recent change to check overflow in drm_calloc, this means that
all allocations that require multiplication are now checked. Also use
drm_calloc() when zeroing is needed and drop the bzero/memset
afterwards. Finally, make drm_free() check for NULL, so we don't need
to do so every time.
ok miod@, deraadt@
Diffstat (limited to 'sys/dev/pci/drm/drm_auth.c')
| -rw-r--r-- | sys/dev/pci/drm/drm_auth.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm_auth.c b/sys/dev/pci/drm/drm_auth.c index cbe4fd88cd0..02568d915cd 100644 --- a/sys/dev/pci/drm/drm_auth.c +++ b/sys/dev/pci/drm/drm_auth.c @@ -70,7 +70,7 @@ drm_add_magic(struct drm_device *dev, struct drm_file *priv, drm_magic_t magic) DRM_SPINLOCK_ASSERT(&dev->dev_lock); - if ((entry = malloc(sizeof(*entry), M_DRM, M_ZERO | M_NOWAIT)) == NULL) + if ((entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC)) == NULL) return (ENOMEM); entry->magic = magic; entry->priv = priv; @@ -97,7 +97,7 @@ drm_remove_magic(struct drm_device *dev, drm_magic_t magic) if ((pt = SPLAY_FIND(drm_magic_tree, &dev->magiclist, &key)) == NULL) return (EINVAL); SPLAY_REMOVE(drm_magic_tree, &dev->magiclist, pt); - free(pt, M_DRM); + drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); return (0); } |
