summaryrefslogtreecommitdiffstats
path: root/fs/char_dev.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2009-01-06 14:41:08 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 15:59:13 -0800
commit8c4018884a49eb2c6c7ca90804f331b12983561c (patch)
tree5a9b972e76c340db5feebda40d9643611a1b84d2 /fs/char_dev.c
parentba84be2338d3a2b6020d39279335bb06fcd332e1 (diff)
downloadlinux-8c4018884a49eb2c6c7ca90804f331b12983561c.tar.bz2
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: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r--fs/char_dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c
index 700697a72618..38f71222a552 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -120,7 +120,7 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
cd->major = major;
cd->baseminor = baseminor;
cd->minorct = minorct;
- strncpy(cd->name,name, 64);
+ strlcpy(cd->name, name, sizeof(cd->name));
i = major_to_index(major);