Skip to contentSkip to conversation

Replace strncmp() with sysfs_streq() in overlay_manager_store()

PATCH Superseded Archit Taneja 1 participant 1 message Jul 6, 2010 Framebuffer layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Replace strncmp() with sysfs_streq() in overlay_manager_store()

In the function overlay_manager_store, the length of the string buf is used to comapre the 2 strings, there is a possibility of false positive match if buf is a prefix string of another manager.

The use of sysfs_streq() fixes this.

---
 drivers/video/omap2/dss/overlay.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/omap2/dss/overlay.c +1 -1
index 8233658..244dca8
@@ -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;
Signature · 1 line
1.5.4.7