diff options
-rw-r--r-- | drivers/isdn/hysdn/hysdn_proclog.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 7003698e667d..2ee93d04b2dd 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
19 | #include <linux/kernel.h> | ||
19 | 20 | ||
20 | #include "hysdn_defs.h" | 21 | #include "hysdn_defs.h" |
21 | 22 | ||
@@ -155,9 +156,8 @@ static ssize_t | |||
155 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) | 156 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) |
156 | { | 157 | { |
157 | unsigned long u = 0; | 158 | unsigned long u = 0; |
158 | int found = 0; | 159 | int rc; |
159 | unsigned char *cp, valbuf[128]; | 160 | unsigned char valbuf[128]; |
160 | long base = 10; | ||
161 | hysdn_card *card = file->private_data; | 161 | hysdn_card *card = file->private_data; |
162 | 162 | ||
163 | if (count > (sizeof(valbuf) - 1)) | 163 | if (count > (sizeof(valbuf) - 1)) |
@@ -166,32 +166,10 @@ hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t | |||
166 | return (-EFAULT); /* copy failed */ | 166 | return (-EFAULT); /* copy failed */ |
167 | 167 | ||
168 | valbuf[count] = 0; /* terminating 0 */ | 168 | valbuf[count] = 0; /* terminating 0 */ |
169 | cp = valbuf; | ||
170 | if ((count > 2) && (valbuf[0] == '0') && (valbuf[1] == 'x')) { | ||
171 | cp += 2; /* pointer after hex modifier */ | ||
172 | base = 16; | ||
173 | } | ||
174 | /* scan the input for debug flags */ | ||
175 | while (*cp) { | ||
176 | if ((*cp >= '0') && (*cp <= '9')) { | ||
177 | found = 1; | ||
178 | u *= base; /* adjust to next digit */ | ||
179 | u += *cp++ - '0'; | ||
180 | continue; | ||
181 | } | ||
182 | if (base != 16) | ||
183 | break; /* end of number */ | ||
184 | |||
185 | if ((*cp >= 'a') && (*cp <= 'f')) { | ||
186 | found = 1; | ||
187 | u *= base; /* adjust to next digit */ | ||
188 | u += *cp++ - 'a' + 10; | ||
189 | continue; | ||
190 | } | ||
191 | break; /* terminated */ | ||
192 | } | ||
193 | 169 | ||
194 | if (found) { | 170 | rc = strict_strtoul(valbuf, 0, &u); |
171 | |||
172 | if (rc == 0) { | ||
195 | card->debug_flags = u; /* remember debug flags */ | 173 | card->debug_flags = u; /* remember debug flags */ |
196 | hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags); | 174 | hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags); |
197 | } | 175 | } |