mISDN: Fix overlapping data access
authorKarsten Keil <keil@b1-systems.de>
Tue, 2 Jun 2009 13:37:37 +0000 (15:37 +0200)
committerKarsten Keil <keil@b1-systems.de>
Thu, 11 Jun 2009 17:04:54 +0000 (19:04 +0200)
Remove code rewriting a buffer by itself.
This fix bug 12970 on bugzilla.kernel.org.

Signed-off-by: Karsten Keil <keil@b1-systems.de>
drivers/isdn/mISDN/dsp_pipeline.c

index ac61f198eb32031400823055f34015ff988f607d..e9941678edfa52ff51baa83b75a8d659017926b9 100644 (file)
@@ -55,20 +55,19 @@ static ssize_t
 attr_show_args(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct mISDN_dsp_element *elem = dev_get_drvdata(dev);
-       ssize_t len = 0;
-       int i = 0;
+       int i;
+       char *p = buf;
 
        *buf = 0;
-       for (; i < elem->num_args; ++i)
-               len = sprintf(buf, "%sName:        %s\n%s%s%sDescription: %s\n"
-                       "\n", buf,
+       for (i = 0; i < elem->num_args; i++)
+               p += sprintf(p, "Name:        %s\n%s%s%sDescription: %s\n\n",
                          elem->args[i].name,
                          elem->args[i].def ? "Default:     " : "",
                          elem->args[i].def ? elem->args[i].def : "",
                          elem->args[i].def ? "\n" : "",
                          elem->args[i].desc);
 
-       return len;
+       return p - buf;
 }
 
 static struct device_attribute element_attributes[] = {