diff options
| -rw-r--r-- | kernel/trace/trace_events_hist.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index c5448c103770..9d590138f870 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c | |||
| @@ -1881,8 +1881,8 @@ static int parse_action(char *str, struct hist_trigger_attrs *attrs) | |||
| 1881 | if (attrs->n_actions >= HIST_ACTIONS_MAX) | 1881 | if (attrs->n_actions >= HIST_ACTIONS_MAX) |
| 1882 | return ret; | 1882 | return ret; |
| 1883 | 1883 | ||
| 1884 | if ((strncmp(str, "onmatch(", sizeof("onmatch(") - 1) == 0) || | 1884 | if ((str_has_prefix(str, "onmatch(")) || |
| 1885 | (strncmp(str, "onmax(", sizeof("onmax(") - 1) == 0)) { | 1885 | (str_has_prefix(str, "onmax("))) { |
| 1886 | attrs->action_str[attrs->n_actions] = kstrdup(str, GFP_KERNEL); | 1886 | attrs->action_str[attrs->n_actions] = kstrdup(str, GFP_KERNEL); |
| 1887 | if (!attrs->action_str[attrs->n_actions]) { | 1887 | if (!attrs->action_str[attrs->n_actions]) { |
| 1888 | ret = -ENOMEM; | 1888 | ret = -ENOMEM; |
| @@ -1899,34 +1899,34 @@ static int parse_assignment(char *str, struct hist_trigger_attrs *attrs) | |||
| 1899 | { | 1899 | { |
| 1900 | int ret = 0; | 1900 | int ret = 0; |
| 1901 | 1901 | ||
| 1902 | if ((strncmp(str, "key=", sizeof("key=") - 1) == 0) || | 1902 | if ((str_has_prefix(str, "key=")) || |
| 1903 | (strncmp(str, "keys=", sizeof("keys=") - 1) == 0)) { | 1903 | (str_has_prefix(str, "keys="))) { |
| 1904 | attrs->keys_str = kstrdup(str, GFP_KERNEL); | 1904 | attrs->keys_str = kstrdup(str, GFP_KERNEL); |
| 1905 | if (!attrs->keys_str) { | 1905 | if (!attrs->keys_str) { |
| 1906 | ret = -ENOMEM; | 1906 | ret = -ENOMEM; |
| 1907 | goto out; | 1907 | goto out; |
| 1908 | } | 1908 | } |
| 1909 | } else if ((strncmp(str, "val=", sizeof("val=") - 1) == 0) || | 1909 | } else if ((str_has_prefix(str, "val=")) || |
| 1910 | (strncmp(str, "vals=", sizeof("vals=") - 1) == 0) || | 1910 | (str_has_prefix(str, "vals=")) || |
| 1911 | (strncmp(str, "values=", sizeof("values=") - 1) == 0)) { | 1911 | (str_has_prefix(str, "values="))) { |
| 1912 | attrs->vals_str = kstrdup(str, GFP_KERNEL); | 1912 | attrs->vals_str = kstrdup(str, GFP_KERNEL); |
| 1913 | if (!attrs->vals_str) { | 1913 | if (!attrs->vals_str) { |
| 1914 | ret = -ENOMEM; | 1914 | ret = -ENOMEM; |
| 1915 | goto out; | 1915 | goto out; |
| 1916 | } | 1916 | } |
| 1917 | } else if (strncmp(str, "sort=", sizeof("sort=") - 1) == 0) { | 1917 | } else if (str_has_prefix(str, "sort=")) { |
| 1918 | attrs->sort_key_str = kstrdup(str, GFP_KERNEL); | 1918 | attrs->sort_key_str = kstrdup(str, GFP_KERNEL); |
| 1919 | if (!attrs->sort_key_str) { | 1919 | if (!attrs->sort_key_str) { |
| 1920 | ret = -ENOMEM; | 1920 | ret = -ENOMEM; |
| 1921 | goto out; | 1921 | goto out; |
| 1922 | } | 1922 | } |
| 1923 | } else if (strncmp(str, "name=", sizeof("name=") - 1) == 0) { | 1923 | } else if (str_has_prefix(str, "name=")) { |
| 1924 | attrs->name = kstrdup(str, GFP_KERNEL); | 1924 | attrs->name = kstrdup(str, GFP_KERNEL); |
| 1925 | if (!attrs->name) { | 1925 | if (!attrs->name) { |
| 1926 | ret = -ENOMEM; | 1926 | ret = -ENOMEM; |
| 1927 | goto out; | 1927 | goto out; |
| 1928 | } | 1928 | } |
| 1929 | } else if (strncmp(str, "clock=", sizeof("clock=") - 1) == 0) { | 1929 | } else if (str_has_prefix(str, "clock=")) { |
| 1930 | strsep(&str, "="); | 1930 | strsep(&str, "="); |
| 1931 | if (!str) { | 1931 | if (!str) { |
| 1932 | ret = -EINVAL; | 1932 | ret = -EINVAL; |
| @@ -1939,7 +1939,7 @@ static int parse_assignment(char *str, struct hist_trigger_attrs *attrs) | |||
| 1939 | ret = -ENOMEM; | 1939 | ret = -ENOMEM; |
| 1940 | goto out; | 1940 | goto out; |
| 1941 | } | 1941 | } |
| 1942 | } else if (strncmp(str, "size=", sizeof("size=") - 1) == 0) { | 1942 | } else if (str_has_prefix(str, "size=")) { |
| 1943 | int map_bits = parse_map_size(str); | 1943 | int map_bits = parse_map_size(str); |
| 1944 | 1944 | ||
| 1945 | if (map_bits < 0) { | 1945 | if (map_bits < 0) { |
| @@ -3558,7 +3558,7 @@ static struct action_data *onmax_parse(char *str) | |||
| 3558 | if (!onmax_fn_name || !str) | 3558 | if (!onmax_fn_name || !str) |
| 3559 | goto free; | 3559 | goto free; |
| 3560 | 3560 | ||
| 3561 | if (strncmp(onmax_fn_name, "save", sizeof("save") - 1) == 0) { | 3561 | if (str_has_prefix(onmax_fn_name, "save")) { |
| 3562 | char *params = strsep(&str, ")"); | 3562 | char *params = strsep(&str, ")"); |
| 3563 | 3563 | ||
| 3564 | if (!params) { | 3564 | if (!params) { |
| @@ -4346,7 +4346,7 @@ static int parse_actions(struct hist_trigger_data *hist_data) | |||
| 4346 | for (i = 0; i < hist_data->attrs->n_actions; i++) { | 4346 | for (i = 0; i < hist_data->attrs->n_actions; i++) { |
| 4347 | str = hist_data->attrs->action_str[i]; | 4347 | str = hist_data->attrs->action_str[i]; |
| 4348 | 4348 | ||
| 4349 | if (strncmp(str, "onmatch(", sizeof("onmatch(") - 1) == 0) { | 4349 | if (str_has_prefix(str, "onmatch(")) { |
| 4350 | char *action_str = str + sizeof("onmatch(") - 1; | 4350 | char *action_str = str + sizeof("onmatch(") - 1; |
| 4351 | 4351 | ||
| 4352 | data = onmatch_parse(tr, action_str); | 4352 | data = onmatch_parse(tr, action_str); |
| @@ -4355,7 +4355,7 @@ static int parse_actions(struct hist_trigger_data *hist_data) | |||
| 4355 | break; | 4355 | break; |
| 4356 | } | 4356 | } |
| 4357 | data->fn = action_trace; | 4357 | data->fn = action_trace; |
| 4358 | } else if (strncmp(str, "onmax(", sizeof("onmax(") - 1) == 0) { | 4358 | } else if (str_has_prefix(str, "onmax(")) { |
| 4359 | char *action_str = str + sizeof("onmax(") - 1; | 4359 | char *action_str = str + sizeof("onmax(") - 1; |
| 4360 | 4360 | ||
| 4361 | data = onmax_parse(action_str); | 4361 | data = onmax_parse(action_str); |
