Commit 109ab909 authored by Kees Cook's avatar Kees Cook Committed by Dave Airlie

drm/ttm: make sure format string cannot leak in

While zone->name is currently hard coded, the call to kobject_init_and_add()
should follow the more defensive argument list usage (as already done in
other places in ttm_memory.c) where "%s" is used instead of directly passing
in a variable as a format string.
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent d898ce03
...@@ -300,7 +300,8 @@ static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob, ...@@ -300,7 +300,8 @@ static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob,
zone->glob = glob; zone->glob = glob;
glob->zone_highmem = zone; glob->zone_highmem = zone;
ret = kobject_init_and_add( ret = kobject_init_and_add(
&zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, "%s",
zone->name);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
kobject_put(&zone->kobj); kobject_put(&zone->kobj);
return ret; return ret;
......
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