Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Kees Cook <keescook@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Kees Cook and committed by
Dave Airlie
109ab909 d898ce03

+2 -1
+2 -1
drivers/gpu/drm/ttm/ttm_memory.c
··· 300 300 zone->glob = glob; 301 301 glob->zone_highmem = zone; 302 302 ret = kobject_init_and_add( 303 - &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); 303 + &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, "%s", 304 + zone->name); 304 305 if (unlikely(ret != 0)) { 305 306 kobject_put(&zone->kobj); 306 307 return ret;