diff options
Diffstat (limited to 'fs/cifs/cifs_debug.c')
-rw-r--r-- | fs/cifs/cifs_debug.c | 56 |
1 files changed, 14 insertions, 42 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 50b268483302..788e19195991 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
@@ -255,7 +255,6 @@ static const struct file_operations cifs_debug_data_proc_fops = { | |||
255 | static ssize_t cifs_stats_proc_write(struct file *file, | 255 | static ssize_t cifs_stats_proc_write(struct file *file, |
256 | const char __user *buffer, size_t count, loff_t *ppos) | 256 | const char __user *buffer, size_t count, loff_t *ppos) |
257 | { | 257 | { |
258 | char c; | ||
259 | bool bv; | 258 | bool bv; |
260 | int rc; | 259 | int rc; |
261 | struct list_head *tmp1, *tmp2, *tmp3; | 260 | struct list_head *tmp1, *tmp2, *tmp3; |
@@ -263,11 +262,8 @@ static ssize_t cifs_stats_proc_write(struct file *file, | |||
263 | struct cifs_ses *ses; | 262 | struct cifs_ses *ses; |
264 | struct cifs_tcon *tcon; | 263 | struct cifs_tcon *tcon; |
265 | 264 | ||
266 | rc = get_user(c, buffer); | 265 | rc = kstrtobool_from_user(buffer, count, &bv); |
267 | if (rc) | 266 | if (rc == 0) { |
268 | return rc; | ||
269 | |||
270 | if (strtobool(&c, &bv) == 0) { | ||
271 | #ifdef CONFIG_CIFS_STATS2 | 267 | #ifdef CONFIG_CIFS_STATS2 |
272 | atomic_set(&totBufAllocCount, 0); | 268 | atomic_set(&totBufAllocCount, 0); |
273 | atomic_set(&totSmBufAllocCount, 0); | 269 | atomic_set(&totSmBufAllocCount, 0); |
@@ -290,6 +286,8 @@ static ssize_t cifs_stats_proc_write(struct file *file, | |||
290 | } | 286 | } |
291 | } | 287 | } |
292 | spin_unlock(&cifs_tcp_ses_lock); | 288 | spin_unlock(&cifs_tcp_ses_lock); |
289 | } else { | ||
290 | return rc; | ||
293 | } | 291 | } |
294 | 292 | ||
295 | return count; | 293 | return count; |
@@ -433,17 +431,17 @@ static int cifsFYI_proc_open(struct inode *inode, struct file *file) | |||
433 | static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer, | 431 | static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer, |
434 | size_t count, loff_t *ppos) | 432 | size_t count, loff_t *ppos) |
435 | { | 433 | { |
436 | char c; | 434 | char c[2] = { '\0' }; |
437 | bool bv; | 435 | bool bv; |
438 | int rc; | 436 | int rc; |
439 | 437 | ||
440 | rc = get_user(c, buffer); | 438 | rc = get_user(c[0], buffer); |
441 | if (rc) | 439 | if (rc) |
442 | return rc; | 440 | return rc; |
443 | if (strtobool(&c, &bv) == 0) | 441 | if (strtobool(c, &bv) == 0) |
444 | cifsFYI = bv; | 442 | cifsFYI = bv; |
445 | else if ((c > '1') && (c <= '9')) | 443 | else if ((c[0] > '1') && (c[0] <= '9')) |
446 | cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */ | 444 | cifsFYI = (int) (c[0] - '0'); /* see cifs_debug.h for meanings */ |
447 | 445 | ||
448 | return count; | 446 | return count; |
449 | } | 447 | } |
@@ -471,20 +469,12 @@ static int cifs_linux_ext_proc_open(struct inode *inode, struct file *file) | |||
471 | static ssize_t cifs_linux_ext_proc_write(struct file *file, | 469 | static ssize_t cifs_linux_ext_proc_write(struct file *file, |
472 | const char __user *buffer, size_t count, loff_t *ppos) | 470 | const char __user *buffer, size_t count, loff_t *ppos) |
473 | { | 471 | { |
474 | char c; | ||
475 | bool bv; | ||
476 | int rc; | 472 | int rc; |
477 | 473 | ||
478 | rc = get_user(c, buffer); | 474 | rc = kstrtobool_from_user(buffer, count, &linuxExtEnabled); |
479 | if (rc) | 475 | if (rc) |
480 | return rc; | 476 | return rc; |
481 | 477 | ||
482 | rc = strtobool(&c, &bv); | ||
483 | if (rc) | ||
484 | return rc; | ||
485 | |||
486 | linuxExtEnabled = bv; | ||
487 | |||
488 | return count; | 478 | return count; |
489 | } | 479 | } |
490 | 480 | ||
@@ -511,20 +501,12 @@ static int cifs_lookup_cache_proc_open(struct inode *inode, struct file *file) | |||
511 | static ssize_t cifs_lookup_cache_proc_write(struct file *file, | 501 | static ssize_t cifs_lookup_cache_proc_write(struct file *file, |
512 | const char __user *buffer, size_t count, loff_t *ppos) | 502 | const char __user *buffer, size_t count, loff_t *ppos) |
513 | { | 503 | { |
514 | char c; | ||
515 | bool bv; | ||
516 | int rc; | 504 | int rc; |
517 | 505 | ||
518 | rc = get_user(c, buffer); | 506 | rc = kstrtobool_from_user(buffer, count, &lookupCacheEnabled); |
519 | if (rc) | 507 | if (rc) |
520 | return rc; | 508 | return rc; |
521 | 509 | ||
522 | rc = strtobool(&c, &bv); | ||
523 | if (rc) | ||
524 | return rc; | ||
525 | |||
526 | lookupCacheEnabled = bv; | ||
527 | |||
528 | return count; | 510 | return count; |
529 | } | 511 | } |
530 | 512 | ||
@@ -551,20 +533,12 @@ static int traceSMB_proc_open(struct inode *inode, struct file *file) | |||
551 | static ssize_t traceSMB_proc_write(struct file *file, const char __user *buffer, | 533 | static ssize_t traceSMB_proc_write(struct file *file, const char __user *buffer, |
552 | size_t count, loff_t *ppos) | 534 | size_t count, loff_t *ppos) |
553 | { | 535 | { |
554 | char c; | ||
555 | bool bv; | ||
556 | int rc; | 536 | int rc; |
557 | 537 | ||
558 | rc = get_user(c, buffer); | 538 | rc = kstrtobool_from_user(buffer, count, &traceSMB); |
559 | if (rc) | 539 | if (rc) |
560 | return rc; | 540 | return rc; |
561 | 541 | ||
562 | rc = strtobool(&c, &bv); | ||
563 | if (rc) | ||
564 | return rc; | ||
565 | |||
566 | traceSMB = bv; | ||
567 | |||
568 | return count; | 542 | return count; |
569 | } | 543 | } |
570 | 544 | ||
@@ -622,7 +596,6 @@ static ssize_t cifs_security_flags_proc_write(struct file *file, | |||
622 | int rc; | 596 | int rc; |
623 | unsigned int flags; | 597 | unsigned int flags; |
624 | char flags_string[12]; | 598 | char flags_string[12]; |
625 | char c; | ||
626 | bool bv; | 599 | bool bv; |
627 | 600 | ||
628 | if ((count < 1) || (count > 11)) | 601 | if ((count < 1) || (count > 11)) |
@@ -635,11 +608,10 @@ static ssize_t cifs_security_flags_proc_write(struct file *file, | |||
635 | 608 | ||
636 | if (count < 3) { | 609 | if (count < 3) { |
637 | /* single char or single char followed by null */ | 610 | /* single char or single char followed by null */ |
638 | c = flags_string[0]; | 611 | if (strtobool(flags_string, &bv) == 0) { |
639 | if (strtobool(&c, &bv) == 0) { | ||
640 | global_secflags = bv ? CIFSSEC_MAX : CIFSSEC_DEF; | 612 | global_secflags = bv ? CIFSSEC_MAX : CIFSSEC_DEF; |
641 | return count; | 613 | return count; |
642 | } else if (!isdigit(c)) { | 614 | } else if (!isdigit(flags_string[0])) { |
643 | cifs_dbg(VFS, "Invalid SecurityFlags: %s\n", | 615 | cifs_dbg(VFS, "Invalid SecurityFlags: %s\n", |
644 | flags_string); | 616 | flags_string); |
645 | return -EINVAL; | 617 | return -EINVAL; |