All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Asahi Lina <lina@asahilina.net>
Cc: oe-kbuild-all@lists.linux.dev, Janne Grunau <j@jannau.net>
Subject: [asahilinux:asahi-wip-7.2 645/964] warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`)
Date: Mon, 24 Aug 2026 06:48:20 +0200	[thread overview]
Message-ID: <202608240637.5LUnBC0c-lkp@intel.com> (raw)

tree:   https://github.com/AsahiLinux/linux asahi-wip-7.2
head:   57124f5176e4a4ceb553942a5f3de94cb5035877
commit: b43e4afc340b3afc32dbb781176c790a5897f163 [645/964] rust: dma_fence: Add DMA Fence abstraction
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260824/202608240637.5LUnBC0c-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
rustc: rustc 1.96.0 (ac68faa20 2026-05-25)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260824/202608240637.5LUnBC0c-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608240637.5LUnBC0c-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`)
   --> rust/kernel/dma_fence.rs:173:22
   |
   173 |     let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> };
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_cast
   = note: `-W clippy::unnecessary-cast` implied by `-W clippy::all`
   = help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_cast)]`
   help: try
   |
   173 ~     let p = unsafe { {
   174 +         let offset: usize = ::core::mem::offset_of!($Container, $($fields)*);
   175 +         let field_ptr = $field_ptr;
   176 +         let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>();
   177 +         $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut());
   178 +         container_ptr
   179 ~     } };
   |
--
>> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`)
   --> rust/kernel/dma_fence.rs:183:22
   |
   183 |     let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> };
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_cast
   help: try
   |
   183 ~     let p = unsafe { {
   184 +         let offset: usize = ::core::mem::offset_of!($Container, $($fields)*);
   185 +         let field_ptr = $field_ptr;
   186 +         let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>();
   187 +         $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut());
   188 +         container_ptr
   189 ~     } };
   |
--
>> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`)
   --> rust/kernel/dma_fence.rs:191:22
   |
   191 |     let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> };
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_cast
   help: try
   |
   191 ~     let p = unsafe { {
   192 +         let offset: usize = ::core::mem::offset_of!($Container, $($fields)*);
   193 +         let field_ptr = $field_ptr;
   194 +         let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>();
   195 +         $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut());
   196 +         container_ptr
   197 ~     } };
   |
--
>> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`)
   --> rust/kernel/dma_fence.rs:199:22
   |
   199 |     let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> };
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_cast
   help: try
   |
   199 ~     let p = unsafe { {
   200 +         let offset: usize = ::core::mem::offset_of!($Container, $($fields)*);
   201 +         let field_ptr = $field_ptr;
   202 +         let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>();
   203 +         $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut());
   204 +         container_ptr
   205 ~     } };
   |
--
>> warning: associated items `as_ref` and `as_raw` are never used
   --> rust/kernel/dma_buf.rs:31:26
   |
   23 | impl DmaBuf {
   | ----------- associated items in this implementation
   ...
   31 |     pub(crate) unsafe fn as_ref<'a>(self_ptr: *mut bindings::dma_buf) -> &'a Self {
   |                          ^^^^^^
   ...
   36 |     pub(crate) fn as_raw(&self) -> *mut bindings::dma_buf {
   |                   ^^^^^^
   |
   = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
--
>> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`)
   --> rust/kernel/dma_fence.rs:207:22
   |
   207 |     let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> };
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_cast
   help: try
   |
   207 ~     let p = unsafe { {
   208 +         let offset: usize = ::core::mem::offset_of!($Container, $($fields)*);
   209 +         let field_ptr = $field_ptr;
   210 +         let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>();
   211 +         $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut());
   212 +         container_ptr
   213 ~     } };
   |
--
>> warning: `as` casting between raw pointers while changing only its constness
   --> rust/kernel/dma_fence.rs:268:9
   |
   268 |         &self.fence as *const _ as *mut _
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `(&self.fence as *const bindings::dma_fence).cast_mut()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#ptr_cast_constness
   = note: requested on the command line with `-W clippy::ptr-cast-constness`
--
>> warning: casts from `u32` to `u64` can be expressed infallibly using `From`
   --> rust/kernel/dma_fence.rs:434:30
   |
   434 |                 self.start + context as u64,
   |                              ^^^^^^^^^^^^^^
   |
   = help: an `as` cast can become silently lossy if the types change in the future
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#cast_lossless
   = note: requested on the command line with `-W clippy::cast-lossless`
   help: use `u64::from` instead
   |
   434 -                 self.start + context as u64,
   434 +                 self.start + u64::from(context),
   |
--
>> warning: method `into_raw` is never used
   --> rust/kernel/dma_fence.rs:467:19
   |
   451 | impl FenceChain {
   | --------------- method in this implementation
   ...
   467 |     pub(crate) fn into_raw(self) -> *mut bindings::dma_fence_chain {
   |                   ^^^^^^^^

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-08-24  4:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202608240637.5LUnBC0c-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=j@jannau.net \
    --cc=lina@asahilina.net \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 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.