All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Alexander Viro <aviro@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] fs - fix name overwrite in __register_chrdev_region
Date: Sun, 14 Dec 2008 00:49:11 +0300	[thread overview]
Message-ID: <20081213214911.GI16354@localhost> (raw)

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

At least chrdev_show does not like it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

 fs/char_dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.git/fs/char_dev.c
===================================================================
--- linux-2.6.git.orig/fs/char_dev.c
+++ linux-2.6.git/fs/char_dev.c
@@ -120,7 +120,7 @@ __register_chrdev_region(unsigned int ma
 	cd->major = major;
 	cd->baseminor = baseminor;
 	cd->minorct = minorct;
-	strncpy(cd->name,name, 64);
+	strncpy(cd->name, name, sizeof(cd->name) - 1);
 
 	i = major_to_index(major);
 

             reply	other threads:[~2008-12-13 21:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-13 21:49 Cyrill Gorcunov [this message]
2008-12-16  5:57 ` [PATCH] fs - fix name overwrite in __register_chrdev_region Andrew Morton
2008-12-16  6:45   ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081213214911.GI16354@localhost \
    --to=gorcunov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aviro@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.