From: Roel Kluin Date: Sat, 29 Aug 2009 20:20:34 +0000 (+0200) Subject: drm: dereference of tmp in drm_proc_create_files() X-Git-Tag: Ubuntu-5.2.0-15.16~27592^2~91 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1ae70072f0699916c1a77a9bacad958ee46f7395;p=mirror_ubuntu-eoan-kernel.git drm: dereference of tmp in drm_proc_create_files() tmp allocation may fail, prevent a dereference. Signed-off-by: Roel Kluin Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c index bbd4b3d1074a..dc967af7a33c 100644 --- a/drivers/gpu/drm/drm_proc.c +++ b/drivers/gpu/drm/drm_proc.c @@ -106,6 +106,10 @@ int drm_proc_create_files(struct drm_info_list *files, int count, continue; tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL); + if (tmp == NULL) { + ret = -1; + goto fail; + } ent = create_proc_entry(files[i].name, S_IFREG | S_IRUGO, root); if (!ent) { DRM_ERROR("Cannot create /proc/dri/%s/%s\n",