Commit 8c401888 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Linus Torvalds

fs: fix name overwrite in __register_chrdev_region()

It's possible to register a chrdev with a name size exactly the same as
was allocated in structure.  It seems it was not intended behaviour.

At least chrdev_show does not like it.
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ba84be23
...@@ -120,7 +120,7 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor, ...@@ -120,7 +120,7 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
cd->major = major; cd->major = major;
cd->baseminor = baseminor; cd->baseminor = baseminor;
cd->minorct = minorct; cd->minorct = minorct;
strncpy(cd->name,name, 64); strlcpy(cd->name, name, sizeof(cd->name));
i = major_to_index(major); i = major_to_index(major);
......
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