mirror of https://github.com/torvalds/linux.git
s390/boot: Add sized_strscpy() to enable strscpy() usage
Add a simple sized_strscpy() implementation to allow the use of strscpy() in the decompressor. Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
fe20164177
commit
f271df9d41
|
|
@ -29,6 +29,18 @@ int strncmp(const char *cs, const char *ct, size_t count)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssize_t sized_strscpy(char *dst, const char *src, size_t count)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
return -E2BIG;
|
||||||
|
len = strnlen(src, count - 1);
|
||||||
|
memcpy(dst, src, len);
|
||||||
|
dst[len] = '\0';
|
||||||
|
return src[len] ? -E2BIG : len;
|
||||||
|
}
|
||||||
|
|
||||||
void *memset64(uint64_t *s, uint64_t v, size_t count)
|
void *memset64(uint64_t *s, uint64_t v, size_t count)
|
||||||
{
|
{
|
||||||
uint64_t *xs = s;
|
uint64_t *xs = s;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue