All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Dave Airlie <airlied@redhat.com>
Cc: Jiri Slaby <jslaby@suse.cz>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] vga_switcheroo: comparing too few characters in strncmp()
Date: Fri, 07 Jan 2011 05:12:27 +0000	[thread overview]
Message-ID: <20110107051227.GD1717@bicker> (raw)

This is a copy-and-paste bug.  We should be comparing 4 characters here
instead of 3.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index d2d8543..e01cacb 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -346,11 +346,11 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf,
 	if (strncmp(usercmd, "DIS", 3) = 0)
 		client_id = VGA_SWITCHEROO_DIS;
 
-	if (strncmp(usercmd, "MIGD", 3) = 0) {
+	if (strncmp(usercmd, "MIGD", 4) = 0) {
 		just_mux = true;
 		client_id = VGA_SWITCHEROO_IGD;
 	}
-	if (strncmp(usercmd, "MDIS", 3) = 0) {
+	if (strncmp(usercmd, "MDIS", 4) = 0) {
 		just_mux = true;
 		client_id = VGA_SWITCHEROO_DIS;
 	}

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Dave Airlie <airlied@redhat.com>
Cc: Jiri Slaby <jslaby@suse.cz>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] vga_switcheroo: comparing too few characters in strncmp()
Date: Fri, 7 Jan 2011 08:12:27 +0300	[thread overview]
Message-ID: <20110107051227.GD1717@bicker> (raw)

This is a copy-and-paste bug.  We should be comparing 4 characters here
instead of 3.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index d2d8543..e01cacb 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -346,11 +346,11 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf,
 	if (strncmp(usercmd, "DIS", 3) == 0)
 		client_id = VGA_SWITCHEROO_DIS;
 
-	if (strncmp(usercmd, "MIGD", 3) == 0) {
+	if (strncmp(usercmd, "MIGD", 4) == 0) {
 		just_mux = true;
 		client_id = VGA_SWITCHEROO_IGD;
 	}
-	if (strncmp(usercmd, "MDIS", 3) == 0) {
+	if (strncmp(usercmd, "MDIS", 4) == 0) {
 		just_mux = true;
 		client_id = VGA_SWITCHEROO_DIS;
 	}

             reply	other threads:[~2011-01-07  5:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-07  5:12 Dan Carpenter [this message]
2011-01-07  5:12 ` [patch] vga_switcheroo: comparing too few characters in strncmp() Dan Carpenter
2011-01-07  5:30 ` [patch] vga_switcheroo: comparing too few characters in Alexey Dobriyan
2011-01-07  5:30   ` [patch] vga_switcheroo: comparing too few characters in strncmp() Alexey Dobriyan
2011-01-07  6:05   ` [patch] vga_switcheroo: comparing too few characters in Dan Carpenter
2011-01-07  6:05     ` [patch] vga_switcheroo: comparing too few characters in strncmp() Dan Carpenter
2011-01-07  6:07   ` Mailing Lists

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=20110107051227.GD1717@bicker \
    --to=error27@gmail.com \
    --cc=airlied@redhat.com \
    --cc=jslaby@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --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.