Commit 1ce1513f48e3bc4d55ee672f0e39f5063a02ab7a
1 parent
8a745b9d91
Exists in
master
and in
7 other branches
mISDN: Fix overlapping data access
Remove code rewriting a buffer by itself. This fix bug 12970 on bugzilla.kernel.org. Signed-off-by: Karsten Keil <keil@b1-systems.de>
Showing 1 changed file with 5 additions and 6 deletions Side-by-side Diff
drivers/isdn/mISDN/dsp_pipeline.c
... | ... | @@ -55,20 +55,19 @@ |
55 | 55 | attr_show_args(struct device *dev, struct device_attribute *attr, char *buf) |
56 | 56 | { |
57 | 57 | struct mISDN_dsp_element *elem = dev_get_drvdata(dev); |
58 | - ssize_t len = 0; | |
59 | - int i = 0; | |
58 | + int i; | |
59 | + char *p = buf; | |
60 | 60 | |
61 | 61 | *buf = 0; |
62 | - for (; i < elem->num_args; ++i) | |
63 | - len = sprintf(buf, "%sName: %s\n%s%s%sDescription: %s\n" | |
64 | - "\n", buf, | |
62 | + for (i = 0; i < elem->num_args; i++) | |
63 | + p += sprintf(p, "Name: %s\n%s%s%sDescription: %s\n\n", | |
65 | 64 | elem->args[i].name, |
66 | 65 | elem->args[i].def ? "Default: " : "", |
67 | 66 | elem->args[i].def ? elem->args[i].def : "", |
68 | 67 | elem->args[i].def ? "\n" : "", |
69 | 68 | elem->args[i].desc); |
70 | 69 | |
71 | - return len; | |
70 | + return p - buf; | |
72 | 71 | } |
73 | 72 | |
74 | 73 | static struct device_attribute element_attributes[] = { |