All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: ysato@users.sourceforge.jp, dalias@libc.org
Cc: linux-sh@vger.kernel.org, bhe@redhat.com,
	linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: [PATCH] sh: cast away __iomem to remove sparse warning
Date: Sat,  7 May 2022 09:34:11 +0800	[thread overview]
Message-ID: <20220507013411.74277-1-bhe@redhat.com> (raw)

LKP reported a sparse warning in arch/sh/kernel/crash_dump.c during
a kdump patchset reviewing:
https://lore.kernel.org/all/202204082128.JKXXDGpa-lkp@intel.com/T/#u

../arch/sh/kernel/crash_dump.c:23:36: sparse: warning: incorrect type in argument 1 (different address spaces)
../arch/sh/kernel/crash_dump.c:23:36: sparse:    expected void const *addr
../arch/sh/kernel/crash_dump.c:23:36: sparse:    got void [noderef] __iomem *

This warning happened when __iomem pointer is passed into fucntion
which doesn't expect it. Casting away the __iomem can fix it.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/sh/kernel/crash_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/kernel/crash_dump.c b/arch/sh/kernel/crash_dump.c
index 19ce6a950aac..52d1d54eb6b1 100644
--- a/arch/sh/kernel/crash_dump.c
+++ b/arch/sh/kernel/crash_dump.c
@@ -20,7 +20,7 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn,
 		return 0;
 
 	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
-	csize = copy_to_iter(vaddr + offset, csize, iter);
+	csize = copy_to_iter((const void __force *)vaddr + offset, csize, iter);
 	iounmap(vaddr);
 
 	return csize;
-- 
2.34.1


             reply	other threads:[~2022-05-07  1:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07  1:34 Baoquan He [this message]
2022-05-30 12:09 ` [PATCH] sh: cast away __iomem to remove sparse warning Baoquan He
2022-06-07 22:56   ` Rob Landley
2022-06-08  1:11     ` Baoquan He
2022-06-08  7:05       ` John Paul Adrian Glaubitz
2022-06-08  7:52         ` Baoquan He

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=20220507013411.74277-1-bhe@redhat.com \
    --to=bhe@redhat.com \
    --cc=dalias@libc.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=ysato@users.sourceforge.jp \
    /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.