Skip to content

Commit

Permalink
fs: fix name overwrite in __register_chrdev_region()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cyrill Gorcunov authored and Linus Torvalds committed Jan 6, 2009
1 parent ba84be2 commit 8c40188
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/char_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 8c40188

Please sign in to comment.