From: Qu Wenruo <wqu@suse.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, christophe.jaillet@wanadoo.fr,
David.Laight@aculab.com, ddiss@suse.de, geert@linux-m68k.org
Subject: Re: [PATCH v3 0/4] kstrtox: introduce memparse_safe()
Date: Mon, 15 Jan 2024 06:31:05 +1030 [thread overview]
Message-ID: <a85ba39e-74cb-4dce-b8df-0416df5b28e0@suse.com> (raw)
In-Reply-To: <ZaPkz7gU42Eahf4L@smile.fi.intel.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 2170 bytes --]
On 2024/1/15 00:12, Andy Shevchenko wrote:
> On Sun, Jan 07, 2024 at 07:28:27AM +1030, Qu Wenruo wrote:
>> On 2024/1/7 01:04, Andy Shevchenko wrote:
>>> On Thu, Jan 04, 2024 at 09:57:47AM +1030, Qu Wenruo wrote:
>
> ...
>
>>> Having test cases is quite good, thanks!
>>> But as I understood what Alexey wanted, is not using the kstrtox files for this.
>>> You can introduce it in the cmdline.c, correct? Just include local "kstrtox.h".
>>
>> Not really possible, all the needed parsing helpers are internal inside
>> kstrtox.c.
>
> I'm not sure I follow. The functions are available to other library (built-in)
> modules.
Did I miss something?
Firstly neither _parse_integer_fixup_radix() nor _parse_integer_limit()
is exported to modules. (No EXPORT_SYMBOL() call on them).
Secondly _parse_integer_fixup_radix() and _parse_integer_limit have "_"
prefix, and is only declared in "lib/kstrtox.h", which means they are
designed only for internal usage.
If putting memparse_safe() into cmdline.c, at least we would need to
include local header "kstrtox.h", and I'm not sure if this is any better
than putting memparse_safe() into kstrtox.[ch].
Finally, I just tried putting memparse_safe() into cmdline.c, and it
failed at linkage stage, even if that offending file has no call to
memparse_safe():
ld: arch/x86/boot/compressed/kaslr.o: in function `memparse_safe':
kaslr.c:(.text+0xbb1): undefined reference to `_parse_integer_fixup_radix'
ld: kaslr.c:(.text+0xbc5): undefined reference to `_parse_integer'
ld: arch/x86/boot/compressed/vmlinux: hidden symbol `_parse_integer'
isn't defined
I can try again but I'm not sure if it's possible to move
memparse_safe() to cmdline.[ch].
>
>> Furthermore, this also means memparse() can not be enhanced due to:
>>
>> - Lack of ways to return errors
>
> What does this mean?
If you want to keep the prototype of memparse() (aka, a drop-in
enhancement), then there is no good way to indicate the errors like
overflow at all.
>
>> - Unable to call the parsing helpers inside cmdline.c
>
> ??? (see above)
>
See above.
Thanks,
Qu
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7027 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
next prev parent reply other threads:[~2024-01-14 20:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-03 23:27 Qu Wenruo
2024-01-03 23:27 ` [PATCH v3 1/4] kstrtox: always skip the leading "0x" even if no more valid chars Qu Wenruo
2024-01-03 23:27 ` [PATCH v3 2/4] kstrtox: introduce a safer version of memparse() Qu Wenruo
2024-01-04 6:30 ` Randy Dunlap
2024-01-04 6:42 ` Qu Wenruo
2024-01-04 6:50 ` Randy Dunlap
2024-01-04 6:55 ` Qu Wenruo
2024-01-03 23:27 ` [PATCH v3 3/4] kstrtox: add unit tests for memparse_safe() Qu Wenruo
2024-01-03 23:27 ` [PATCH v3 4/4] btrfs: migrate to the newer memparse_safe() helper Qu Wenruo
2024-01-06 14:34 ` [PATCH v3 0/4] kstrtox: introduce memparse_safe() Andy Shevchenko
2024-01-06 20:58 ` Qu Wenruo
2024-01-14 13:42 ` Andy Shevchenko
2024-01-14 20:01 ` Qu Wenruo [this message]
2024-02-01 15:18 Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a85ba39e-74cb-4dce-b8df-0416df5b28e0@suse.com \
--to=wqu@suse.com \
--cc=David.Laight@aculab.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=ddiss@suse.de \
--cc=geert@linux-m68k.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®