public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] OMAP: DSS2: Replace strncmp() with sysfs_streq() in overlay_manager_store()
@ 2010-08-02 13:14 archit taneja
  2010-08-02 13:26 ` Tomi Valkeinen
  0 siblings, 1 reply; 2+ messages in thread
From: archit taneja @ 2010-08-02 13:14 UTC (permalink / raw)
  To: tomi.valkeinen; +Cc: linux-omap, Archit Taneja

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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] OMAP: DSS2: Replace strncmp() with sysfs_streq() in overlay_manager_store()
  2010-08-02 13:14 [PATCH v2] OMAP: DSS2: Replace strncmp() with sysfs_streq() in overlay_manager_store() archit taneja
@ 2010-08-02 13:26 ` Tomi Valkeinen
  0 siblings, 0 replies; 2+ messages in thread
From: Tomi Valkeinen @ 2010-08-02 13:26 UTC (permalink / raw)
  To: ext archit taneja; +Cc: linux-omap@vger.kernel.org

On Mon, 2010-08-02 at 15:14 +0200, ext archit taneja wrote:
> 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>

Looks good, thanks!

 Tomi



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-02 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-02 13:14 [PATCH v2] OMAP: DSS2: Replace strncmp() with sysfs_streq() in overlay_manager_store() archit taneja
2010-08-02 13:26 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox