Commit 85dd1dd6 authored by Colin Ian King's avatar Colin Ian King Committed by Melissa Wen

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: 2df7af93 ("drm/vkms: Add vkms_config type")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarSumera Priyadarsini <sylphrenadin@gmail.com>
Signed-off-by: default avatarMelissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210115130911.71073-1-colin.king@canonical.com
parent 0d7ab835
......@@ -188,7 +188,11 @@ static int vkms_create(struct vkms_config *config)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment