mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
drm/vkms: Fix missing kmalloc allocation failure check
Currently the kmalloc allocation for config is not being null
checked and could potentially lead to a null pointer dereference.
Fix this by adding the missing null check.
Addresses-Coverity: ("Dereference null return value")
Fixes: 2df7af93fd
("drm/vkms: Add vkms_config type")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210115130911.71073-1-colin.king@canonical.com
This commit is contained in:
parent
0d7ab83546
commit
85dd1dd6e2
@ -188,7 +188,11 @@ out_unregister:
|
||||
|
||||
static int __init vkms_init(void)
|
||||
{
|
||||
struct vkms_config *config = kmalloc(sizeof(*config), GFP_KERNEL);
|
||||
struct vkms_config *config;
|
||||
|
||||
config = kmalloc(sizeof(*config), GFP_KERNEL);
|
||||
if (!config)
|
||||
return -ENOMEM;
|
||||
|
||||
default_config = config;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user