Messages in this thread Patch in this message | | | From | Jiri Slaby <> | Subject | [PATCH 1/2] GPU: drm_debugfs, check kmalloc retval | Date | Mon, 13 Jul 2009 23:20:20 +0200 |
| |
Check kmalloc return value in drm_debugfs_create_files and bail out appropriately if the pointer is NULL.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com> --- drivers/gpu/drm/drm_debugfs.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 2960b6d..9903f27 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -101,6 +101,10 @@ int drm_debugfs_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 = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO, root, tmp, &drm_debugfs_fops); if (!ent) { -- 1.6.3.2
| |