Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

orangefs-debugfs.c: fix parsing problem with kernel debug keywords.

When /sys/kernel/debug/orangefs/kernel-debug was set to a single
keyword, the keyword was ignored. Now single and multiple keyword
settings produce the expected debug output to the ring buffer.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>

+11 -10
+11 -10
fs/orangefs/orangefs-debugfs.c
··· 443 443 count = ORANGEFS_MAX_DEBUG_STRING_LEN; 444 444 } 445 445 446 - buf = memdup_user_nul(ubuf, count - 1); 446 + buf = memdup_user_nul(ubuf, count); 447 447 if (IS_ERR(buf)) { 448 448 gossip_debug(GOSSIP_DEBUGFS_DEBUG, 449 449 "%s: memdup_user_nul failed!\n", ··· 452 452 buf = NULL; 453 453 goto out; 454 454 } 455 + strim(buf); 455 456 456 457 /* 457 458 * Map the keyword string from userspace into a valid debug mask. ··· 874 873 */ 875 874 static void debug_string_to_mask(char *debug_string, void *mask, int type) 876 875 { 877 - char *unchecked_keyword; 878 876 int i; 879 877 char *strsep_fodder = kstrdup(debug_string, GFP_KERNEL); 878 + char *trimmed; 879 + char *token; 880 880 char *original_pointer; 881 881 int element_count = 0; 882 882 struct client_debug_mask *c_mask = NULL; ··· 895 893 } 896 894 897 895 original_pointer = strsep_fodder; 898 - while ((unchecked_keyword = strsep(&strsep_fodder, ","))) 899 - if (strlen(unchecked_keyword)) { 896 + while ((token = strsep(&strsep_fodder, ",")) != NULL) { 897 + trimmed = strim(token); 898 + if (*trimmed) { 900 899 for (i = 0; i < element_count; i++) 901 900 if (type) 902 - do_c_mask(i, 903 - unchecked_keyword, 904 - &c_mask); 901 + do_c_mask(i, trimmed, &c_mask); 905 902 else 906 - do_k_mask(i, 907 - unchecked_keyword, 908 - &k_mask); 903 + do_k_mask(i, trimmed, &k_mask); 904 + 909 905 } 906 + } 910 907 911 908 kfree(original_pointer); 912 909 }