| From | Jens Axboe <> | Subject | [PATCH 434/437] lib/string_helpers: kill parse_int_array_user() | Date | Thu, 11 Apr 2024 09:19:34 -0600 |
| |
It's no longer used, get rid of it.
Signed-off-by: Jens Axboe <axboe@kernel.dk> --- include/linux/string_helpers.h | 1 - lib/string_helpers.c | 61 ++++++++++------------------------ 2 files changed, 18 insertions(+), 44 deletions(-)
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index f38157114fc0..5e913f1fad60 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -32,7 +32,6 @@ enum string_size_units { int string_get_size(u64 size, u64 blk_size, const enum string_size_units units, char *buf, int len); -int parse_int_array_user(const char __user *from, size_t count, int **array); int parse_int_array_iter(struct iov_iter *from, int **array); #define UNESCAPE_SPACE BIT(0) diff --git a/lib/string_helpers.c b/lib/string_helpers.c index ced4f77dc5e8..8582f9adfa76 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c @@ -138,10 +138,27 @@ int string_get_size(u64 size, u64 blk_size, const enum string_size_units units, } EXPORT_SYMBOL(string_get_size); -static int __parse_int_array(char *buf, int **array) +/** + * parse_int_array_iter - Split string into a sequence of integers + * @from: The iov_iter buffer to read from + * @array: Returned pointer to sequence of integers + * + * On success @array is allocated and initialized with a sequence of + * integers extracted from the @from plus an additional element that + * begins the sequence and specifies the integers count. + * + * Caller takes responsibility for freeing @array when it is no longer + * needed. + */ +int parse_int_array_iter(struct iov_iter *from, int **array) { int *ints, nints; int ret = 0; + char *buf; + + buf = iterdup_nul(from, iov_iter_count(from)); + if (IS_ERR(buf)) + return PTR_ERR(buf); get_options(buf, 0, &nints); if (!nints) { @@ -161,49 +178,7 @@ static int __parse_int_array(char *buf, int **array) free_buf: kfree(buf); return ret; -} - -/** - * parse_int_array_user - Split string into a sequence of integers - * @from: The user space buffer to read from - * @count: The maximum number of bytes to read - * @array: Returned pointer to sequence of integers - * - * On success @array is allocated and initialized with a sequence of - * integers extracted from the @from plus an additional element that - * begins the sequence and specifies the integers count. - * - * Caller takes responsibility for freeing @array when it is no longer - * needed. - */ -int parse_int_array_user(const char __user *from, size_t count, int **array) -{ - char *buf; - - buf = memdup_user_nul(from, count); - if (IS_ERR(buf)) - return PTR_ERR(buf); - - return __parse_int_array(buf, array); -} -EXPORT_SYMBOL(parse_int_array_user); - -/** - * parse_int_array_iter - Split string into a sequence of integers - * @from: The iov_iter buffer to read from - * @array: Returned pointer to sequence of integers - * - * See @parse_int_array_user, this is just the iov_iter variant. - */ -int parse_int_array_iter(struct iov_iter *from, int **array) -{ - char *buf; - - buf = iterdup_nul(from, iov_iter_count(from)); - if (IS_ERR(buf)) - return PTR_ERR(buf); - return __parse_int_array(buf, array); } EXPORT_SYMBOL(parse_int_array_iter); -- 2.43.0
|