diff options
author | Kees Cook <keescook@chromium.org> | 2013-07-03 18:04:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 19:07:41 -0400 |
commit | 02aa2a37636c8fa4fb9322d91be46ff8225b7de0 (patch) | |
tree | 97c93d17cfcad186d229ef76f96de709eddfea8c /mm/backing-dev.c | |
parent | 096a8aac6bf4a5a0b2ef812ad76d056bbf3fb2af (diff) |
drivers: avoid format string in dev_set_name
Calling dev_set_name with a single paramter causes it to be handled as a
format string. Many callers are passing potentially dynamic string
content, so use "%s" in those cases to avoid any potential accidents,
including wrappers like device_create*() and bdi_register().
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/backing-dev.c')
-rw-r--r-- | mm/backing-dev.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 502517492258..d014ee5fcbbd 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -515,7 +515,6 @@ EXPORT_SYMBOL(bdi_destroy); | |||
515 | int bdi_setup_and_register(struct backing_dev_info *bdi, char *name, | 515 | int bdi_setup_and_register(struct backing_dev_info *bdi, char *name, |
516 | unsigned int cap) | 516 | unsigned int cap) |
517 | { | 517 | { |
518 | char tmp[32]; | ||
519 | int err; | 518 | int err; |
520 | 519 | ||
521 | bdi->name = name; | 520 | bdi->name = name; |
@@ -524,8 +523,8 @@ int bdi_setup_and_register(struct backing_dev_info *bdi, char *name, | |||
524 | if (err) | 523 | if (err) |
525 | return err; | 524 | return err; |
526 | 525 | ||
527 | sprintf(tmp, "%.28s%s", name, "-%d"); | 526 | err = bdi_register(bdi, NULL, "%.28s-%ld", name, |
528 | err = bdi_register(bdi, NULL, tmp, atomic_long_inc_return(&bdi_seq)); | 527 | atomic_long_inc_return(&bdi_seq)); |
529 | if (err) { | 528 | if (err) { |
530 | bdi_destroy(bdi); | 529 | bdi_destroy(bdi); |
531 | return err; | 530 | return err; |