From: Kees Cook Date: Thu, 11 Sep 2014 20:53:54 +0000 (-0700) Subject: drm/ttm: make sure format string cannot leak in X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=109ab90974995a06aeabab1535b0ce00f26dd24a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index dbc2def887cd..a1803fbcc898 100644 --- a/drivers/gpu/drm/ttm/ttm_memory.c +++ b/drivers/gpu/drm/ttm/ttm_memory.c @@ -300,7 +300,8 @@ static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob, zone->glob = glob; glob->zone_highmem = zone; 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)) { kobject_put(&zone->kobj); return ret;