diff options
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r-- | lib/vsprintf.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index f9532e09b608..a315138ece55 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -1786,6 +1786,13 @@ EXPORT_SYMBOL_GPL(bprintf); | |||
1786 | 1786 | ||
1787 | #endif /* CONFIG_BINARY_PRINTF */ | 1787 | #endif /* CONFIG_BINARY_PRINTF */ |
1788 | 1788 | ||
1789 | static noinline char *skip_space(const char *str) | ||
1790 | { | ||
1791 | while (isspace(*str)) | ||
1792 | ++str; | ||
1793 | return (char *)str; | ||
1794 | } | ||
1795 | |||
1789 | /** | 1796 | /** |
1790 | * vsscanf - Unformat a buffer into a list of arguments | 1797 | * vsscanf - Unformat a buffer into a list of arguments |
1791 | * @buf: input buffer | 1798 | * @buf: input buffer |
@@ -1807,10 +1814,8 @@ int vsscanf(const char *buf, const char *fmt, va_list args) | |||
1807 | * white space, including none, in the input. | 1814 | * white space, including none, in the input. |
1808 | */ | 1815 | */ |
1809 | if (isspace(*fmt)) { | 1816 | if (isspace(*fmt)) { |
1810 | while (isspace(*fmt)) | 1817 | fmt = skip_space(fmt); |
1811 | ++fmt; | 1818 | str = skip_space(str); |
1812 | while (isspace(*str)) | ||
1813 | ++str; | ||
1814 | } | 1819 | } |
1815 | 1820 | ||
1816 | /* anything that is not a conversion must match exactly */ | 1821 | /* anything that is not a conversion must match exactly */ |
@@ -1880,8 +1885,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) | |||
1880 | if (field_width == -1) | 1885 | if (field_width == -1) |
1881 | field_width = INT_MAX; | 1886 | field_width = INT_MAX; |
1882 | /* first, skip leading white space in buffer */ | 1887 | /* first, skip leading white space in buffer */ |
1883 | while (isspace(*str)) | 1888 | str = skip_space(str); |
1884 | str++; | ||
1885 | 1889 | ||
1886 | /* now copy until next white space */ | 1890 | /* now copy until next white space */ |
1887 | while (*str && !isspace(*str) && field_width--) | 1891 | while (*str && !isspace(*str) && field_width--) |
@@ -1923,8 +1927,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) | |||
1923 | /* have some sort of integer conversion. | 1927 | /* have some sort of integer conversion. |
1924 | * first, skip white space in buffer. | 1928 | * first, skip white space in buffer. |
1925 | */ | 1929 | */ |
1926 | while (isspace(*str)) | 1930 | str = skip_space(str); |
1927 | str++; | ||
1928 | 1931 | ||
1929 | digit = *str; | 1932 | digit = *str; |
1930 | if (is_sign && digit == '-') | 1933 | if (is_sign && digit == '-') |