* Re: [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input()
@ 2022-09-02 20:28 kernel test robot
0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2022-09-02 20:28 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6770 bytes --]
::::::
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check warning: lib/string_helpers.c:150:20: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]"
::::::
BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220901175022.334824-2-cezary.rojewski@intel.com>
References: <20220901175022.334824-2-cezary.rojewski@intel.com>
TO: Cezary Rojewski <cezary.rojewski@intel.com>
TO: alsa-devel(a)alsa-project.org
TO: broonie(a)kernel.org
CC: andy(a)kernel.org
CC: Cezary Rojewski <cezary.rojewski@intel.com>
CC: kai.vehmanen(a)linux.intel.com
CC: yung-chuan.liao(a)linux.intel.com
CC: tiwai(a)suse.com
CC: pierre-louis.bossart(a)linux.intel.com
CC: willy(a)infradead.org
CC: lgirdwood(a)gmail.com
CC: hdegoede(a)redhat.com
CC: Andy Shevchenko <andy.shevchenko@gmail.com>
CC: ranjani.sridharan(a)linux.intel.com
CC: amadeuszx.slawinski(a)linux.intel.com
CC: peter.ujfalusi(a)linux.intel.com
CC: linux-kernel(a)vger.kernel.org
Hi Cezary,
I love your patch! Perhaps something to improve:
[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on linus/master v6.0-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Cezary-Rojewski/lib-string_helpers-Introduce-tokenize_user_input/20220902-014254
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
:::::: branch date: 27 hours ago
:::::: commit date: 27 hours ago
config: arm-randconfig-c002-20220901 (https://download.01.org/0day-ci/archive/20220903/202209030411.0HeReNTd-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/53e2025c60da991b4e879aaf336a6635c0b87b07
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Cezary-Rojewski/lib-string_helpers-Introduce-tokenize_user_input/20220902-014254
git checkout 53e2025c60da991b4e879aaf336a6635c0b87b07
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error'
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
gcc_analyzer warnings: (new ones prefixed by >>)
lib/string_helpers.c: In function 'tokenize_user_input':
>> lib/string_helpers.c:150:20: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
150 | int *ints, nints;
| ^~~~~
'tokenize_user_input': event 1
|
| 150 | int *ints, nints;
| | ^~~~~
| | |
| | (1) use of uninitialized value '<unknown>' here
|
vim +150 lib/string_helpers.c
16c7fa05829e8b9 Andy Shevchenko 2013-04-30 133
53e2025c60da991 Cezary Rojewski 2022-09-01 134 /**
53e2025c60da991 Cezary Rojewski 2022-09-01 135 * tokenize_user_input - Split string into a sequence of integers
53e2025c60da991 Cezary Rojewski 2022-09-01 136 * @from: The user space buffer to read from
53e2025c60da991 Cezary Rojewski 2022-09-01 137 * @ppos: The current position in the buffer
53e2025c60da991 Cezary Rojewski 2022-09-01 138 * @count: The maximum number of bytes to read
53e2025c60da991 Cezary Rojewski 2022-09-01 139 * @tkns: Returned pointer to sequence of integers
53e2025c60da991 Cezary Rojewski 2022-09-01 140 *
53e2025c60da991 Cezary Rojewski 2022-09-01 141 * On success @tkns is allocated and initialized with a sequence of
53e2025c60da991 Cezary Rojewski 2022-09-01 142 * integers extracted from the @from plus an additional element that
53e2025c60da991 Cezary Rojewski 2022-09-01 143 * begins the sequence and specifies the integers count.
53e2025c60da991 Cezary Rojewski 2022-09-01 144 *
53e2025c60da991 Cezary Rojewski 2022-09-01 145 * Caller takes responsibility for freeing @tkns when it is no longer
53e2025c60da991 Cezary Rojewski 2022-09-01 146 * needed.
53e2025c60da991 Cezary Rojewski 2022-09-01 147 */
53e2025c60da991 Cezary Rojewski 2022-09-01 148 int tokenize_user_input(const char __user *from, size_t count, int **tkns)
53e2025c60da991 Cezary Rojewski 2022-09-01 149 {
53e2025c60da991 Cezary Rojewski 2022-09-01 @150 int *ints, nints;
53e2025c60da991 Cezary Rojewski 2022-09-01 151 char *buf;
53e2025c60da991 Cezary Rojewski 2022-09-01 152 int ret = 0;
53e2025c60da991 Cezary Rojewski 2022-09-01 153
53e2025c60da991 Cezary Rojewski 2022-09-01 154 buf = memdup_user_nul(from, count);
53e2025c60da991 Cezary Rojewski 2022-09-01 155 if (IS_ERR(buf))
53e2025c60da991 Cezary Rojewski 2022-09-01 156 return PTR_ERR(buf);
53e2025c60da991 Cezary Rojewski 2022-09-01 157
53e2025c60da991 Cezary Rojewski 2022-09-01 158 get_options(buf, 0, &nints);
53e2025c60da991 Cezary Rojewski 2022-09-01 159 if (!nints) {
53e2025c60da991 Cezary Rojewski 2022-09-01 160 ret = -ENOENT;
53e2025c60da991 Cezary Rojewski 2022-09-01 161 goto free_buf;
53e2025c60da991 Cezary Rojewski 2022-09-01 162 }
53e2025c60da991 Cezary Rojewski 2022-09-01 163
53e2025c60da991 Cezary Rojewski 2022-09-01 164 ints = kcalloc(nints + 1, sizeof(*ints), GFP_KERNEL);
53e2025c60da991 Cezary Rojewski 2022-09-01 165 if (!ints) {
53e2025c60da991 Cezary Rojewski 2022-09-01 166 ret = -ENOMEM;
53e2025c60da991 Cezary Rojewski 2022-09-01 167 goto free_buf;
53e2025c60da991 Cezary Rojewski 2022-09-01 168 }
53e2025c60da991 Cezary Rojewski 2022-09-01 169
53e2025c60da991 Cezary Rojewski 2022-09-01 170 get_options(buf, nints + 1, ints);
53e2025c60da991 Cezary Rojewski 2022-09-01 171 *tkns = ints;
53e2025c60da991 Cezary Rojewski 2022-09-01 172
53e2025c60da991 Cezary Rojewski 2022-09-01 173 free_buf:
53e2025c60da991 Cezary Rojewski 2022-09-01 174 kfree(buf);
53e2025c60da991 Cezary Rojewski 2022-09-01 175 return ret;
53e2025c60da991 Cezary Rojewski 2022-09-01 176 }
53e2025c60da991 Cezary Rojewski 2022-09-01 177 EXPORT_SYMBOL(tokenize_user_input);
53e2025c60da991 Cezary Rojewski 2022-09-01 178
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 0/2] lib/string_helpers: Introduce tokenize_user_input()
@ 2022-09-01 17:50 Cezary Rojewski
2022-09-01 17:50 ` Cezary Rojewski
0 siblings, 1 reply; 9+ messages in thread
From: Cezary Rojewski @ 2022-09-01 17:50 UTC (permalink / raw)
To: alsa-devel, broonie
Cc: andy, Cezary Rojewski, kai.vehmanen, yung-chuan.liao, tiwai,
pierre-louis.bossart, willy, lgirdwood, hdegoede,
ranjani.sridharan, amadeuszx.slawinski, peter.ujfalusi,
linux-kernel
Continuation of recent upstream discussion [1] regarding user string
tokenization.
First, tokenize_user_input() is introduced to allow for splitting
specified user string into a sequence of integers. Makes use of
get_options() internally so the parsing logic is not duplicated.
With that done, redundant parts of the sound driver are removed.
Originally similar functionality was added for the SOF sound driver. As
more users are on the horizon, it is desirable to update existing
string_helpers code and provide a unified solution.
Changes in v3:
- relocated tokenize_user_input() implementation to string_helpers as
requested by Matthew
Changes in v2:
- reused get_options() so no parsing logic is duplicated
- simplified __user variant with help of memdup_user_nul()
Both suggested by Andy, thanks for thourough review
[1]: https://lore.kernel.org/alsa-devel/20220707091301.1282291-1-cezary.rojewski@intel.com/
Cezary Rojewski (2):
lib/string_helpers: Introduce tokenize_user_input()
ASoC: SOF: Remove strsplit_u32() and tokenize_input()
include/linux/string_helpers.h | 2 +
lib/string_helpers.c | 45 +++++++++++++++
sound/soc/sof/sof-client-probes.c | 93 ++++---------------------------
3 files changed, 59 insertions(+), 81 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input()
2022-09-01 17:50 [PATCH v3 0/2] " Cezary Rojewski
@ 2022-09-01 17:50 ` Cezary Rojewski
0 siblings, 0 replies; 9+ messages in thread
From: Cezary Rojewski @ 2022-09-01 17:50 UTC (permalink / raw)
To: alsa-devel, broonie
Cc: andy, Cezary Rojewski, kai.vehmanen, yung-chuan.liao, tiwai,
pierre-louis.bossart, willy, lgirdwood, hdegoede,
Andy Shevchenko, ranjani.sridharan, amadeuszx.slawinski,
peter.ujfalusi, linux-kernel
Add new helper function to allow for splitting specified user string
into a sequence of integers. Internally it makes use of get_options() so
the returned sequence contains the integers extracted plus an additional
element that begins the sequence and specifies the integers count.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
include/linux/string_helpers.h | 2 ++
lib/string_helpers.c | 45 ++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 4d72258d42fd..97583dae556f 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -21,6 +21,8 @@ enum string_size_units {
void string_get_size(u64 size, u64 blk_size, enum string_size_units units,
char *buf, int len);
+int tokenize_user_input(const char __user *from, size_t count, int **tkns);
+
#define UNESCAPE_SPACE BIT(0)
#define UNESCAPE_OCTAL BIT(1)
#define UNESCAPE_HEX BIT(2)
diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index 5ed3beb066e6..f878afccab4c 100644
--- a/lib/string_helpers.c
+++ b/lib/string_helpers.c
@@ -131,6 +131,51 @@ void string_get_size(u64 size, u64 blk_size, const enum string_size_units units,
}
EXPORT_SYMBOL(string_get_size);
+/**
+ * tokenize_user_input - Split string into a sequence of integers
+ * @from: The user space buffer to read from
+ * @ppos: The current position in the buffer
+ * @count: The maximum number of bytes to read
+ * @tkns: Returned pointer to sequence of integers
+ *
+ * On success @tkns 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 @tkns when it is no longer
+ * needed.
+ */
+int tokenize_user_input(const char __user *from, size_t count, int **tkns)
+{
+ int *ints, nints;
+ char *buf;
+ int ret = 0;
+
+ buf = memdup_user_nul(from, count);
+ if (IS_ERR(buf))
+ return PTR_ERR(buf);
+
+ get_options(buf, 0, &nints);
+ if (!nints) {
+ ret = -ENOENT;
+ goto free_buf;
+ }
+
+ ints = kcalloc(nints + 1, sizeof(*ints), GFP_KERNEL);
+ if (!ints) {
+ ret = -ENOMEM;
+ goto free_buf;
+ }
+
+ get_options(buf, nints + 1, ints);
+ *tkns = ints;
+
+free_buf:
+ kfree(buf);
+ return ret;
+}
+EXPORT_SYMBOL(tokenize_user_input);
+
static bool unescape_space(char **src, char **dst)
{
char *p = *dst, *q = *src;
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input()
@ 2022-09-01 17:50 ` Cezary Rojewski
0 siblings, 0 replies; 9+ messages in thread
From: Cezary Rojewski @ 2022-09-01 17:50 UTC (permalink / raw)
To: alsa-devel, broonie
Cc: tiwai, perex, amadeuszx.slawinski, pierre-louis.bossart,
hdegoede, lgirdwood, kai.vehmanen, peter.ujfalusi,
ranjani.sridharan, yung-chuan.liao, andy, linux-kernel, willy,
Cezary Rojewski, Andy Shevchenko
Add new helper function to allow for splitting specified user string
into a sequence of integers. Internally it makes use of get_options() so
the returned sequence contains the integers extracted plus an additional
element that begins the sequence and specifies the integers count.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
include/linux/string_helpers.h | 2 ++
lib/string_helpers.c | 45 ++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 4d72258d42fd..97583dae556f 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -21,6 +21,8 @@ enum string_size_units {
void string_get_size(u64 size, u64 blk_size, enum string_size_units units,
char *buf, int len);
+int tokenize_user_input(const char __user *from, size_t count, int **tkns);
+
#define UNESCAPE_SPACE BIT(0)
#define UNESCAPE_OCTAL BIT(1)
#define UNESCAPE_HEX BIT(2)
diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index 5ed3beb066e6..f878afccab4c 100644
--- a/lib/string_helpers.c
+++ b/lib/string_helpers.c
@@ -131,6 +131,51 @@ void string_get_size(u64 size, u64 blk_size, const enum string_size_units units,
}
EXPORT_SYMBOL(string_get_size);
+/**
+ * tokenize_user_input - Split string into a sequence of integers
+ * @from: The user space buffer to read from
+ * @ppos: The current position in the buffer
+ * @count: The maximum number of bytes to read
+ * @tkns: Returned pointer to sequence of integers
+ *
+ * On success @tkns 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 @tkns when it is no longer
+ * needed.
+ */
+int tokenize_user_input(const char __user *from, size_t count, int **tkns)
+{
+ int *ints, nints;
+ char *buf;
+ int ret = 0;
+
+ buf = memdup_user_nul(from, count);
+ if (IS_ERR(buf))
+ return PTR_ERR(buf);
+
+ get_options(buf, 0, &nints);
+ if (!nints) {
+ ret = -ENOENT;
+ goto free_buf;
+ }
+
+ ints = kcalloc(nints + 1, sizeof(*ints), GFP_KERNEL);
+ if (!ints) {
+ ret = -ENOMEM;
+ goto free_buf;
+ }
+
+ get_options(buf, nints + 1, ints);
+ *tkns = ints;
+
+free_buf:
+ kfree(buf);
+ return ret;
+}
+EXPORT_SYMBOL(tokenize_user_input);
+
static bool unescape_space(char **src, char **dst)
{
char *p = *dst, *q = *src;
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input()
2022-09-01 17:50 ` Cezary Rojewski
@ 2022-09-01 19:34 ` Andy Shevchenko
-1 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2022-09-01 19:34 UTC (permalink / raw)
To: Cezary Rojewski
Cc: ALSA Development Mailing List, Mark Brown, Takashi Iwai,
Jaroslav Kysela, amadeuszx.slawinski, Pierre-Louis Bossart,
Hans de Goede, Liam Girdwood, Kai Vehmanen, Péter Ujfalusi,
Ranjani Sridharan, Bard Liao, Andy Shevchenko,
Linux Kernel Mailing List, Matthew Wilcox
On Thu, Sep 1, 2022 at 8:40 PM Cezary Rojewski
<cezary.rojewski@intel.com> wrote:
>
> Add new helper function to allow for splitting specified user string
> into a sequence of integers. Internally it makes use of get_options() so
> the returned sequence contains the integers extracted plus an additional
> element that begins the sequence and specifies the integers count.
Thanks! In general it looks good to me, but a few minor comments below.
...
> +int tokenize_user_input(const char __user *from, size_t count, int **tkns);
Not sure how I can deduct from the name what function is actually
doing. Suggested new name: int_array_parse_user().
int int_array_parse_user(const char __user *from, size_t count, int **array);
(Note that we have _user suffix for many APIs in the kernel that does
interact with user space memory)
...
> + * @tkns: Returned pointer to sequence of integers
array
...
If you are okay with this, you may add my
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input()
@ 2022-09-01 19:34 ` Andy Shevchenko
0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2022-09-01 19:34 UTC (permalink / raw)
To: Cezary Rojewski
Cc: Andy Shevchenko, ALSA Development Mailing List, Kai Vehmanen,
Liam Girdwood, Bard Liao, Pierre-Louis Bossart, Matthew Wilcox,
Takashi Iwai, Hans de Goede, Mark Brown, Ranjani Sridharan,
amadeuszx.slawinski, Péter Ujfalusi,
Linux Kernel Mailing List
On Thu, Sep 1, 2022 at 8:40 PM Cezary Rojewski
<cezary.rojewski@intel.com> wrote:
>
> Add new helper function to allow for splitting specified user string
> into a sequence of integers. Internally it makes use of get_options() so
> the returned sequence contains the integers extracted plus an additional
> element that begins the sequence and specifies the integers count.
Thanks! In general it looks good to me, but a few minor comments below.
...
> +int tokenize_user_input(const char __user *from, size_t count, int **tkns);
Not sure how I can deduct from the name what function is actually
doing. Suggested new name: int_array_parse_user().
int int_array_parse_user(const char __user *from, size_t count, int **array);
(Note that we have _user suffix for many APIs in the kernel that does
interact with user space memory)
...
> + * @tkns: Returned pointer to sequence of integers
array
...
If you are okay with this, you may add my
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input()
2022-09-01 19:34 ` Andy Shevchenko
@ 2022-09-02 7:46 ` Cezary Rojewski
-1 siblings, 0 replies; 9+ messages in thread
From: Cezary Rojewski @ 2022-09-02 7:46 UTC (permalink / raw)
To: Andy Shevchenko
Cc: ALSA Development Mailing List, Mark Brown, Takashi Iwai,
Jaroslav Kysela, amadeuszx.slawinski, Pierre-Louis Bossart,
Hans de Goede, Liam Girdwood, Kai Vehmanen, Péter Ujfalusi,
Ranjani Sridharan, Bard Liao, Andy Shevchenko,
Linux Kernel Mailing List, Matthew Wilcox
On 2022-09-01 9:34 PM, Andy Shevchenko wrote:
> On Thu, Sep 1, 2022 at 8:40 PM Cezary Rojewski
> <cezary.rojewski@intel.com> wrote:
...
>> +int tokenize_user_input(const char __user *from, size_t count, int **tkns);
>
> Not sure how I can deduct from the name what function is actually
> doing. Suggested new name: int_array_parse_user().
>
> int int_array_parse_user(const char __user *from, size_t count, int **array);
>
> (Note that we have _user suffix for many APIs in the kernel that does
> interact with user space memory)
That's why I've added '_user_' in the middle! Anyway, I guess the
expectation is that it's a suffix - precisely at the end of the name.
Could we reorder it a bit: "parse_int_array_user"?
>> + * @tkns: Returned pointer to sequence of integers
>
> array
Ack.
> If you are okay with this, you may add my
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input()
@ 2022-09-02 7:46 ` Cezary Rojewski
0 siblings, 0 replies; 9+ messages in thread
From: Cezary Rojewski @ 2022-09-02 7:46 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Andy Shevchenko, ALSA Development Mailing List, Kai Vehmanen,
Liam Girdwood, Bard Liao, Pierre-Louis Bossart, Matthew Wilcox,
Takashi Iwai, Hans de Goede, Mark Brown, Ranjani Sridharan,
amadeuszx.slawinski, Péter Ujfalusi,
Linux Kernel Mailing List
On 2022-09-01 9:34 PM, Andy Shevchenko wrote:
> On Thu, Sep 1, 2022 at 8:40 PM Cezary Rojewski
> <cezary.rojewski@intel.com> wrote:
...
>> +int tokenize_user_input(const char __user *from, size_t count, int **tkns);
>
> Not sure how I can deduct from the name what function is actually
> doing. Suggested new name: int_array_parse_user().
>
> int int_array_parse_user(const char __user *from, size_t count, int **array);
>
> (Note that we have _user suffix for many APIs in the kernel that does
> interact with user space memory)
That's why I've added '_user_' in the middle! Anyway, I guess the
expectation is that it's a suffix - precisely at the end of the name.
Could we reorder it a bit: "parse_int_array_user"?
>> + * @tkns: Returned pointer to sequence of integers
>
> array
Ack.
> If you are okay with this, you may add my
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input()
2022-09-02 7:46 ` Cezary Rojewski
@ 2022-09-02 9:04 ` Andy Shevchenko
-1 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2022-09-02 9:04 UTC (permalink / raw)
To: Cezary Rojewski
Cc: ALSA Development Mailing List, Mark Brown, Takashi Iwai,
Jaroslav Kysela, amadeuszx.slawinski, Pierre-Louis Bossart,
Hans de Goede, Liam Girdwood, Kai Vehmanen, Péter Ujfalusi,
Ranjani Sridharan, Bard Liao, Andy Shevchenko,
Linux Kernel Mailing List, Matthew Wilcox
On Fri, Sep 2, 2022 at 10:46 AM Cezary Rojewski
<cezary.rojewski@intel.com> wrote:
> On 2022-09-01 9:34 PM, Andy Shevchenko wrote:
> > On Thu, Sep 1, 2022 at 8:40 PM Cezary Rojewski
> > <cezary.rojewski@intel.com> wrote:
...
> >> +int tokenize_user_input(const char __user *from, size_t count, int **tkns);
> >
> > Not sure how I can deduct from the name what function is actually
> > doing. Suggested new name: int_array_parse_user().
> >
> > int int_array_parse_user(const char __user *from, size_t count, int **array);
> >
> > (Note that we have _user suffix for many APIs in the kernel that does
> > interact with user space memory)
>
> That's why I've added '_user_' in the middle! Anyway, I guess the
> expectation is that it's a suffix - precisely at the end of the name.
>
> Could we reorder it a bit: "parse_int_array_user"?
Most of the exported functions that have 'parse' word, have it after
namespace, but in this case there is no dedicated namespace and it
also will be in alignment with parse_options_str. That said, go for
it.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input()
@ 2022-09-02 9:04 ` Andy Shevchenko
0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2022-09-02 9:04 UTC (permalink / raw)
To: Cezary Rojewski
Cc: Andy Shevchenko, ALSA Development Mailing List, Kai Vehmanen,
Liam Girdwood, Bard Liao, Pierre-Louis Bossart, Matthew Wilcox,
Takashi Iwai, Hans de Goede, Mark Brown, Ranjani Sridharan,
amadeuszx.slawinski, Péter Ujfalusi,
Linux Kernel Mailing List
On Fri, Sep 2, 2022 at 10:46 AM Cezary Rojewski
<cezary.rojewski@intel.com> wrote:
> On 2022-09-01 9:34 PM, Andy Shevchenko wrote:
> > On Thu, Sep 1, 2022 at 8:40 PM Cezary Rojewski
> > <cezary.rojewski@intel.com> wrote:
...
> >> +int tokenize_user_input(const char __user *from, size_t count, int **tkns);
> >
> > Not sure how I can deduct from the name what function is actually
> > doing. Suggested new name: int_array_parse_user().
> >
> > int int_array_parse_user(const char __user *from, size_t count, int **array);
> >
> > (Note that we have _user suffix for many APIs in the kernel that does
> > interact with user space memory)
>
> That's why I've added '_user_' in the middle! Anyway, I guess the
> expectation is that it's a suffix - precisely at the end of the name.
>
> Could we reorder it a bit: "parse_int_array_user"?
Most of the exported functions that have 'parse' word, have it after
namespace, but in this case there is no dedicated namespace and it
also will be in alignment with parse_options_str. That said, go for
it.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-09-02 20:28 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-02 20:28 [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input() kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-09-01 17:50 [PATCH v3 0/2] " Cezary Rojewski
2022-09-01 17:50 ` [PATCH v3 1/2] " Cezary Rojewski
2022-09-01 17:50 ` Cezary Rojewski
2022-09-01 19:34 ` Andy Shevchenko
2022-09-01 19:34 ` Andy Shevchenko
2022-09-02 7:46 ` Cezary Rojewski
2022-09-02 7:46 ` Cezary Rojewski
2022-09-02 9:04 ` Andy Shevchenko
2022-09-02 9:04 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.