drm: drm_debugfs, check kmalloc retval
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> Signed-off-by: Dave Airlie <airlied@linux.ie>
This commit is contained in:
parent
069a9dce38
commit
d25e3a6faa
|
@ -101,6 +101,10 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
|
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,
|
ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
|
||||||
root, tmp, &drm_debugfs_fops);
|
root, tmp, &drm_debugfs_fops);
|
||||||
if (!ent) {
|
if (!ent) {
|
||||||
|
|
Loading…
Reference in New Issue