public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Luis Chamberlain <mcgrof@kernel•org>,
	Petr Pavlu <petr.pavlu@suse•com>,
	Sami Tolvanen <samitolvanen@google•com>,
	Daniel Gomez <da.gomez@samsung•com>,
	Miguel Ojeda <ojeda@kernel•org>
Cc: Tamir Duberstein <tamird@gmail•com>,
	Andreas Hindborg <a.hindborg@kernel•org>,
	Daniel Gomez <da.gomez@kernel•org>,
	Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
	Linux Next Mailing List <linux-next@vger•kernel.org>
Subject: Re: linux-next: build failure after merge of the modules tree
Date: Wed, 5 Nov 2025 15:51:09 +1100	[thread overview]
Message-ID: <20251105155109.1b3fc7d8@canb.auug.org.au> (raw)
In-Reply-To: <20251104154500.5acb5340@canb.auug.org.au>

[-- Attachment #1: Type: text/plain, Size: 3694 bytes --]

Hi all,

On Tue, 4 Nov 2025 15:45:00 +1100 Stephen Rothwell <sfr@canb•auug.org.au> wrote:
>
> After merging the modules tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> error[E0308]: mismatched types
>   --> rust/kernel/module_param.rs:75:47  
>    |
> 75 |         let new_value = T::try_from_param_arg(arg)?;
>    |                         --------------------- ^^^ expected `&BStr`, found `&CStr`
>    |                         |
>    |                         arguments to this function are incorrect
>    |
>    = note: expected reference `&BStr`
>               found reference `&ffi::CStr`
> note: associated function defined here
>   --> rust/kernel/module_param.rs:32:8  
>    |
> 32 |     fn try_from_param_arg(arg: &BStr) -> Result<Self>;
>    |        ^^^^^^^^^^^^^^^^^^
> 
> error: aborting due to 1 previous error
> 
> For more information about this error, try `rustc --explain E0308`.
> 
> Caused by commit
> 
>   0b08fc292842 ("rust: introduce module_param module")
> 
> This is some interaction with something later in linux-next - presumably
> commit
> 
>   3b83f5d5e78a ("rust: replace `CStr` with `core::ffi::CStr`")
> 
> from the rust tree.
> 
> Hopefully someone can provide a resolution for me tomorrow.
> 
> I have used the modules tree from next-20251103 for today.

I have used the modules tree as is and applied the below merge
resolution patch (supplied by Andreas) to the merge of the rust tree.

From: Stephen Rothwell <sfr@canb•auug.org.au>
Date: Wed, 5 Nov 2025 14:52:29 +1100
Subject: [PATCH] fix up for "rust: replace `CStr` with `core::ffi::CStr`"

interacting with commit

  0b08fc292842 ("rust: introduce module_param module")

from the modules tree.

Signed-off-by: Stephen Rothwell <sfr@canb•auug.org.au>
---
 rust/kernel/module_param.rs | 1 +
 rust/macros/module.rs       | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/module_param.rs b/rust/kernel/module_param.rs
index e7d5c930a467..6a8a7a875643 100644
--- a/rust/kernel/module_param.rs
+++ b/rust/kernel/module_param.rs
@@ -70,6 +70,7 @@ pub trait ModuleParam: Sized + Copy {
     // SAFETY: By function safety requirement, val is non-null, null-terminated
     // and valid for reads for the duration of this function.
     let arg = unsafe { CStr::from_char_ptr(val) };
+    let arg: &BStr = arg.as_ref();
 
     crate::error::from_result(|| {
         let new_value = T::try_from_param_arg(arg)?;
diff --git a/rust/macros/module.rs b/rust/macros/module.rs
index 1a22de73d512..f6a94712384f 100644
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@ -133,10 +133,10 @@ fn emit_params(&mut self, info: &ModuleInfo) {
                         ::kernel::module_param::KernelParam::new(
                             ::kernel::bindings::kernel_param {{
                                 name: if ::core::cfg!(MODULE) {{
-                                    ::kernel::c_str!(\"{param_name}\").as_bytes_with_nul()
+                                    ::kernel::c_str!(\"{param_name}\").to_bytes_with_nul()
                                 }} else {{
                                     ::kernel::c_str!(\"{module_name}.{param_name}\")
-                                        .as_bytes_with_nul()
+                                        .to_bytes_with_nul()
                                 }}.as_ptr(),
                                 // SAFETY: `__this_module` is constructed by the kernel at load
                                 // time and will not be freed until the module is unloaded.
-- 
2.51.1

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2025-11-05  4:51 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mb_jUGmjgayTheAB5ZLGso-I856wAQhMkb6zPGnzUyAoUjhzm-QIzkGPLTe-sPI29ax91vO1D3aVy6J7rdTtgg==@protonmail.internalid>
2025-11-04  4:45 ` linux-next: build failure after merge of the modules tree Stephen Rothwell
2025-11-04 10:15   ` Andreas Hindborg
2025-11-05  4:51   ` Stephen Rothwell [this message]
2025-11-05  6:15     ` Daniel Gomez
2025-12-04 22:58     ` Stephen Rothwell
2024-02-02  1:03 Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2022-11-14  0:13 Stephen Rothwell
2022-11-14  8:01 ` Jiri Olsa
2022-11-14  9:08   ` Leizhen (ThunderTown)
2022-02-21 16:07 broonie
2022-02-23  0:32 ` Luis Chamberlain
2022-02-28  5:13   ` Stephen Rothwell
2022-02-28 18:16     ` Luis Chamberlain
2021-02-09 10:08 Stephen Rothwell
2021-02-09 15:16 ` Jessica Yu
2021-02-09 16:06   ` Christoph Hellwig
2021-02-09 21:50   ` Stephen Rothwell
2021-02-10  8:06     ` Jessica Yu
2021-02-10  8:37       ` Masahiro Yamada
2021-02-11  6:19         ` Masahiro Yamada
2021-02-10 12:21       ` Stephen Rothwell
2021-02-10 16:16         ` Jessica Yu
2019-06-25  4:27 Stephen Rothwell
2015-12-01 20:23 Mark Brown
2015-12-02  3:23 ` Rusty Russell
2015-11-27  1:26 Stephen Rothwell
2015-11-27  2:57 ` Rusty Russell
2015-06-25  6:54 Stephen Rothwell
2015-06-25  9:51 ` Dan Streetman
2015-06-24  1:37 Stephen Rothwell
2015-06-24 18:18 ` Dan Streetman
2015-06-24 22:57   ` Stephen Rothwell
2015-06-25  1:50     ` Stephen Rothwell
2014-12-18  2:05 Stephen Rothwell
2014-08-07  3:20 Stephen Rothwell
2014-08-07 11:37 ` Rusty Russell
2014-08-07 13:03   ` Stephen Rothwell
2014-08-07 13:07     ` Rusty Russell
2014-08-08  1:33       ` Stephen Rothwell
2014-07-28  3:58 Stephen Rothwell
2014-07-28 11:38 ` Rusty Russell
2014-03-25  3:02 Stephen Rothwell
2014-03-31  3:45 ` Rusty Russell
2012-11-26  4:10 Stephen Rothwell
2012-11-28 11:02 ` Stanislaw Gruszka
2012-12-03  0:29   ` Rusty Russell
2012-11-02  1:57 Stephen Rothwell
2012-11-02  3:16 ` Rusty Russell

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=20251105155109.1b3fc7d8@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=a.hindborg@kernel$(echo .)org \
    --cc=da.gomez@kernel$(echo .)org \
    --cc=da.gomez@samsung$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=mcgrof@kernel$(echo .)org \
    --cc=ojeda@kernel$(echo .)org \
    --cc=petr.pavlu@suse$(echo .)com \
    --cc=samitolvanen@google$(echo .)com \
    --cc=tamird@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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