Skip to contentSkip to conversation

ieee1394: forgotten dereference...

PATCH In review Al Viro 2 participants 2 messages Jul 15, 2007

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 ieee1394: forgotten dereference...

Going through the string and waiting for _pointer_ to become '\0' is not what the authors meant...

---
 drivers/ieee1394/nodemgr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/ieee1394/nodemgr.c +1 -1
index c4d3d41..51a1206 100644
@@ -283,7 +283,7 @@ static ssize_t fw_show_##class##_##td_kv (struct device *dev, struct device_attr
 	memcpy(buf,							\
 	       CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(class->td_kv),	\
 	       len);							\
-	while ((buf + len - 1) == '\0')					\
+	while (buf[len - 1] == '\0')					\
 		len--;							\
 	buf[len++] = '\n';						\
 	buf[len] = '\0';						\
Signature · 1 line
1.5.3.GIT
#1 lore raw
Quoted 13 lines · Al Viro

Going through the string and waiting for _pointer_ to become '\0' is not what the authors meant...

---
 drivers/ieee1394/nodemgr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/ieee1394/nodemgr.c +0 -0
index c4d3d41..51a1206 100644

drivers/ieee1394/nodemgr.c static ssize_t fw_show_##class##_##td_kv (struct device *dev, struct device_attr · line 289

Quoted 8 lines
drivers/ieee1394/nodemgr.c +1 -1
@@ -283,7 +283,7 @@ static ssize_t fw_show_##class##_##td_kv (struct device *dev, struct device_attr
 	memcpy(buf,							\
 	       CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(class->td_kv),	\
 	       len);							\
-	while ((buf + len - 1) == '\0')					\
+	while (buf[len - 1] == '\0')					\
 		len--;							\
 	buf[len++] = '\n';						\
 	buf[len] = '\0';						\

ACK

Definitely looks right with your patch. Thanks.

Signature · 2 lines
Ubuntu   : http://www.ubuntu.com/
Linux1394: http://wiki.linux1394.org/