As the possible failure of the kstrdup_const(), it should be better to check it and handle it. Signed-off-by: Li Qiong <liqiong@xxxxxxxxxxxx> --- drivers/gpu/drm/drm_managed.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/drm_managed.c b/drivers/gpu/drm/drm_managed.c index 4cf214de50c4..d9bd4a9da559 100644 --- a/drivers/gpu/drm/drm_managed.c +++ b/drivers/gpu/drm/drm_managed.c @@ -151,6 +151,8 @@ int __drmm_add_action(struct drm_device *dev, } dr->node.name = kstrdup_const(name, GFP_KERNEL); + if (!dr->node.name) + return -ENOMEM; if (data) { void_ptr = (void **)&dr->data; *void_ptr = data; @@ -197,6 +199,8 @@ void *drmm_kmalloc(struct drm_device *dev, size_t size, gfp_t gfp) return NULL; } dr->node.name = kstrdup_const("kmalloc", GFP_KERNEL); + if (!dr->node.name) + return NULL; add_dr(dev, dr); -- 2.25.1