diff options
| author | Mark Brown <broonie@kernel.org> | 2018-01-12 18:59:19 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2018-01-12 18:59:19 +0000 |
| commit | 9d66a875ecc7d6dd414121e4508340d6c08f51b0 (patch) | |
| tree | d446bb455780d9058efe1760745bfb63207090de /include/linux/string.h | |
| parent | 987da3fe175933c28aab2293505c3597052ff0e2 (diff) | |
| parent | dd1dbf94d2826a045fbbe2649d84b27d48620d56 (diff) | |
Merge branch 'acpi-gpio' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm into asoc-intel
Diffstat (limited to 'include/linux/string.h')
| -rw-r--r-- | include/linux/string.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/string.h b/include/linux/string.h index 410ecf17de3c..cfd83eb2f926 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -259,7 +259,10 @@ __FORTIFY_INLINE __kernel_size_t strlen(const char *p) { __kernel_size_t ret; size_t p_size = __builtin_object_size(p, 0); - if (p_size == (size_t)-1) + + /* Work around gcc excess stack consumption issue */ + if (p_size == (size_t)-1 || + (__builtin_constant_p(p[p_size - 1]) && p[p_size - 1] == '\0')) return __builtin_strlen(p); ret = strnlen(p, p_size); if (p_size <= ret) |
