diff options
| author | James Morris <james.l.morris@oracle.com> | 2017-05-22 09:32:40 +0300 |
|---|---|---|
| committer | James Morris <james.l.morris@oracle.com> | 2017-05-22 09:32:40 +0300 |
| commit | d68c51e0b377838dd31b37707813bb62089f399c (patch) | |
| tree | 4557d5ced33ea6da60bc84ee288af9924192f046 /include/linux/string.h | |
| parent | 99c55fb18fc48508ae5bba57146a556aacc4558c (diff) | |
| parent | 08332893e37af6ae779367e78e444f8f9571511d (diff) | |
| download | linux-d68c51e0b377838dd31b37707813bb62089f399c.tar.xz | |
Sync to mainline for security submaintainers to work against
Diffstat (limited to 'include/linux/string.h')
| -rw-r--r-- | include/linux/string.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/string.h b/include/linux/string.h index 26b6f6a66f83..537918f8a98e 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -114,6 +114,14 @@ extern int memcmp(const void *,const void *,__kernel_size_t); #ifndef __HAVE_ARCH_MEMCHR extern void * memchr(const void *,int,__kernel_size_t); #endif +#ifndef __HAVE_ARCH_MEMCPY_MCSAFE +static inline __must_check int memcpy_mcsafe(void *dst, const void *src, + size_t cnt) +{ + memcpy(dst, src, cnt); + return 0; +} +#endif void *memchr_inv(const void *s, int c, size_t n); char *strreplace(char *s, char old, char new); @@ -135,6 +143,16 @@ static inline int strtobool(const char *s, bool *res) } int match_string(const char * const *array, size_t n, const char *string); +int __sysfs_match_string(const char * const *array, size_t n, const char *s); + +/** + * sysfs_match_string - matches given string in an array + * @_a: array of strings + * @_s: string to match with + * + * Helper for __sysfs_match_string(). Calculates the size of @a automatically. + */ +#define sysfs_match_string(_a, _s) __sysfs_match_string(_a, ARRAY_SIZE(_a), _s) #ifdef CONFIG_BINARY_PRINTF int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); |
