mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-10-26 10:57:38 +08:00
rust: macros: allow non-ASCII characters in authors
Module authors may have non-ASCII characters in their names. In C, `MODULE_AUTHOR` allows arbitrary string literals which are emitted as raw UTF-8 bytes into the `.modinfo` section, and multiple in-tree modules use non-ASCII author names. Originally, the single `author` field permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit38559da6af("rust: module: introduce `authors` key"), it reused the `expect_string_array` helper that had originally been added for module aliases. Because that helper enforced an ASCII check, `authors` inadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to use `syn` in commitc578ad703a("rust: macros: use `syn` to parse `module!` macro"), this restriction was carried over by using AsciiLitStr in `authors` type. Change the element type of `authors` in `ModuleInfo` from `AsciiLitStr` to `LitStr` so that UTF-8 author names are permitted. Fixes:38559da6af("rust: module: introduce `authors` key") Signed-off-by: Thiébaud Weksteen <tweek@google.com> Acked-by: Petr Pavlu <petr.pavlu@suse.com> Link: https://patch.msgid.link/20260917051147.98775-1-tweek@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
1 parent
c82c75ae11
commit
e91836593f
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -129,7 +129,7 @@ use syn::parse_macro_input;
|
||||
/// # Supported argument types
|
||||
/// - `type`: type which implements the [`Module`] trait (required).
|
||||
/// - `name`: ASCII string literal of the name of the kernel module (required).
|
||||
/// - `authors`: array of ASCII string literals of the authors of the kernel module.
|
||||
/// - `authors`: array of string literals of the authors of the kernel module.
|
||||
/// - `description`: string literal of the description of the kernel module.
|
||||
/// - `license`: ASCII string literal of the license of the kernel module (required).
|
||||
/// - `alias`: array of ASCII string literals of the alias names of the kernel module.
|
||||
|
||||
@@ -369,7 +369,7 @@ pub(crate) struct ModuleInfo {
|
||||
type_: Type,
|
||||
license: AsciiLitStr,
|
||||
name: AsciiLitStr,
|
||||
authors: Option<Punctuated<AsciiLitStr, Token![,]>>,
|
||||
authors: Option<Punctuated<LitStr, Token![,]>>,
|
||||
description: Option<LitStr>,
|
||||
alias: Option<Punctuated<AsciiLitStr, Token![,]>>,
|
||||
firmware: Option<Punctuated<AsciiLitStr, Token![,]>>,
|
||||
|
||||
Reference in new issue
Block a user