提交 1ce1513f 编写于 作者: K Karsten Keil

mISDN: Fix overlapping data access

Remove code rewriting a buffer by itself.
This fix bug 12970 on bugzilla.kernel.org.
Signed-off-by: NKarsten Keil <keil@b1-systems.de>
上级 8a745b9d
...@@ -55,20 +55,19 @@ static ssize_t ...@@ -55,20 +55,19 @@ static ssize_t
attr_show_args(struct device *dev, struct device_attribute *attr, char *buf) attr_show_args(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct mISDN_dsp_element *elem = dev_get_drvdata(dev); struct mISDN_dsp_element *elem = dev_get_drvdata(dev);
ssize_t len = 0; int i;
int i = 0; char *p = buf;
*buf = 0; *buf = 0;
for (; i < elem->num_args; ++i) for (i = 0; i < elem->num_args; i++)
len = sprintf(buf, "%sName: %s\n%s%s%sDescription: %s\n" p += sprintf(p, "Name: %s\n%s%s%sDescription: %s\n\n",
"\n", buf,
elem->args[i].name, elem->args[i].name,
elem->args[i].def ? "Default: " : "", elem->args[i].def ? "Default: " : "",
elem->args[i].def ? elem->args[i].def : "", elem->args[i].def ? elem->args[i].def : "",
elem->args[i].def ? "\n" : "", elem->args[i].def ? "\n" : "",
elem->args[i].desc); elem->args[i].desc);
return len; return p - buf;
} }
static struct device_attribute element_attributes[] = { static struct device_attribute element_attributes[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册