diff options
author | Kees Cook <keescook@chromium.org> | 2014-09-11 16:53:54 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-09-16 21:15:01 -0400 |
commit | 109ab90974995a06aeabab1535b0ce00f26dd24a (patch) | |
tree | d8c0a8c7ae5a783b0a484a9700c30604ec65c041 | |
parent | d898ce03675fc061f89a347a22d41271ed75c436 (diff) |
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>
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_memory.c | 3 |
1 files changed, 2 insertions, 1 deletions
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, | |||
300 | zone->glob = glob; | 300 | zone->glob = glob; |
301 | glob->zone_highmem = zone; | 301 | glob->zone_highmem = zone; |
302 | ret = kobject_init_and_add( | 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 | if (unlikely(ret != 0)) { | 305 | if (unlikely(ret != 0)) { |
305 | kobject_put(&zone->kobj); | 306 | kobject_put(&zone->kobj); |
306 | return ret; | 307 | return ret; |