public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: archit taneja <archit@ti.com>
To: tomi.valkeinen@nokia.com
Cc: linux-omap@vger.kernel.org, Archit Taneja <archit@ti.com>
Subject: [PATCH v2] OMAP: DSS2: Replace strncmp() with sysfs_streq() in overlay_manager_store()
Date: Mon,  2 Aug 2010 18:44:11 +0530	[thread overview]
Message-ID: <1280754851-17077-1-git-send-email-archit@ti.com> (raw)

From: Archit Taneja <archit@ti.com>

The function overlay_manager_store currently fails if the sysfs input is a
prefix string of an existing overlay manager name. This occurs because strncmp
compares the two strings only till the length of the input sysfs string. So a
sysfs input "lcd" will match manager name "lcd2" which is incorrect behavior.

The use of sysfs_streq here will prevent this false positive match to occur.

Signed-off-by: Archit Taneja <archit@ti.com>
---
v2:
 Rewrite the git commit message

v1:
 https://patchwork.kernel.org/patch/114697/

 drivers/video/omap2/dss/overlay.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
index 8233658..244dca8
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -65,7 +65,7 @@ static ssize_t overlay_manager_store(struct omap_overlay *ovl, const char *buf,
 		for (i = 0; i < omap_dss_get_num_overlay_managers(); ++i) {
 			mgr = omap_dss_get_overlay_manager(i);
 
-			if (strncmp(buf, mgr->name, len) == 0)
+			if (sysfs_streq(buf, mgr->name))
 				break;
 
 			mgr = NULL;

             reply	other threads:[~2010-08-02 13:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 13:14 archit taneja [this message]
2010-08-02 13:26 ` [PATCH v2] OMAP: DSS2: Replace strncmp() with sysfs_streq() in overlay_manager_store() Tomi Valkeinen

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=1280754851-17077-1-git-send-email-archit@ti.com \
    --to=archit@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@nokia.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox