linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip:x86/sev 55/55] arch/x86/kernel/sev.c:605:17: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2022-05-02 14:19 kernel test robot
  2022-05-02 14:48 ` Borislav Petkov
  2022-05-02 15:50 ` [tip: x86/sev] x86/sev: Fix address space sparse warning tip-bot2 for Borislav Petkov
  0 siblings, 2 replies; 3+ messages in thread
From: kernel test robot @ 2022-05-02 14:19 UTC (permalink / raw)
  To: Brijesh Singh
  Cc: kbuild-all, linux-kernel, x86, Borislav Petkov, Michael Roth

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/sev
head:   c2106a231c2ba36ff9af50cdf2867b9a5f8150a6
commit: c2106a231c2ba36ff9af50cdf2867b9a5f8150a6 [55/55] x86/sev: Get the AP jump table address from secrets page
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220502/202205022233.XgNDR7WR-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=c2106a231c2ba36ff9af50cdf2867b9a5f8150a6
        git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
        git fetch --no-tags tip x86/sev
        git checkout c2106a231c2ba36ff9af50cdf2867b9a5f8150a6
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kernel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> arch/x86/kernel/sev.c:605:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got struct snp_secrets_page_layout *[assigned] layout @@
   arch/x86/kernel/sev.c:605:17: sparse:     expected void volatile [noderef] __iomem *addr
   arch/x86/kernel/sev.c:605:17: sparse:     got struct snp_secrets_page_layout *[assigned] layout

vim +605 arch/x86/kernel/sev.c

   588	
   589	static u64 __init get_snp_jump_table_addr(void)
   590	{
   591		struct snp_secrets_page_layout *layout;
   592		u64 pa, addr;
   593	
   594		pa = get_secrets_page();
   595		if (!pa)
   596			return 0;
   597	
   598		layout = (__force void *)ioremap_encrypted(pa, PAGE_SIZE);
   599		if (!layout) {
   600			pr_err("Unable to locate AP jump table address: failed to map the SNP secrets page.\n");
   601			return 0;
   602		}
   603	
   604		addr = layout->os_area.ap_jump_table_pa;
 > 605		iounmap(layout);
   606	
   607		return addr;
   608	}
   609	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [tip:x86/sev 55/55] arch/x86/kernel/sev.c:605:17: sparse: sparse: incorrect type in argument 1 (different address spaces)
  2022-05-02 14:19 [tip:x86/sev 55/55] arch/x86/kernel/sev.c:605:17: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
@ 2022-05-02 14:48 ` Borislav Petkov
  2022-05-02 15:50 ` [tip: x86/sev] x86/sev: Fix address space sparse warning tip-bot2 for Borislav Petkov
  1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2022-05-02 14:48 UTC (permalink / raw)
  To: Michael Roth
  Cc: kernel test robot, Brijesh Singh, kbuild-all, linux-kernel, x86,
	Michael Roth

On Mon, May 02, 2022 at 10:19:04PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/sev
> head:   c2106a231c2ba36ff9af50cdf2867b9a5f8150a6
> commit: c2106a231c2ba36ff9af50cdf2867b9a5f8150a6 [55/55] x86/sev: Get the AP jump table address from secrets page
> config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220502/202205022233.XgNDR7WR-lkp@intel.com/config)
> compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.4-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=c2106a231c2ba36ff9af50cdf2867b9a5f8150a6
>         git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>         git fetch --no-tags tip x86/sev
>         git checkout c2106a231c2ba36ff9af50cdf2867b9a5f8150a6
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kernel/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> sparse warnings: (new ones prefixed by >>)
> >> arch/x86/kernel/sev.c:605:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got struct snp_secrets_page_layout *[assigned] layout @@
>    arch/x86/kernel/sev.c:605:17: sparse:     expected void volatile [noderef] __iomem *addr
>    arch/x86/kernel/sev.c:605:17: sparse:     got struct snp_secrets_page_layout *[assigned] layout
> 
> vim +605 arch/x86/kernel/sev.c
> 
>    588	
>    589	static u64 __init get_snp_jump_table_addr(void)
>    590	{
>    591		struct snp_secrets_page_layout *layout;
>    592		u64 pa, addr;
>    593	
>    594		pa = get_secrets_page();
>    595		if (!pa)
>    596			return 0;
>    597	
>    598		layout = (__force void *)ioremap_encrypted(pa, PAGE_SIZE);
>    599		if (!layout) {
>    600			pr_err("Unable to locate AP jump table address: failed to map the SNP secrets page.\n");
>    601			return 0;
>    602		}
>    603	
>    604		addr = layout->os_area.ap_jump_table_pa;
>  > 605		iounmap(layout);
>    606	
>    607		return addr;
>    608	}
>    609	
> 
> -- 

Mike, that ok?

---
diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
index 166375084b1f..c05f0124c410 100644
--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -589,20 +589,23 @@ static u64 __init get_secrets_page(void)
 static u64 __init get_snp_jump_table_addr(void)
 {
 	struct snp_secrets_page_layout *layout;
+	void __iomem *mem;
 	u64 pa, addr;
 
 	pa = get_secrets_page();
 	if (!pa)
 		return 0;
 
-	layout = (__force void *)ioremap_encrypted(pa, PAGE_SIZE);
-	if (!layout) {
+	mem = ioremap_encrypted(pa, PAGE_SIZE);
+	if (!mem) {
 		pr_err("Unable to locate AP jump table address: failed to map the SNP secrets page.\n");
 		return 0;
 	}
 
+	layout = (__force struct snp_secrets_page_layout *)mem;
+
 	addr = layout->os_area.ap_jump_table_pa;
-	iounmap(layout);
+	iounmap(mem);
 
 	return addr;
 }

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Ivo Totev, HRB 36809, AG Nürnberg

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [tip: x86/sev] x86/sev: Fix address space sparse warning
  2022-05-02 14:19 [tip:x86/sev 55/55] arch/x86/kernel/sev.c:605:17: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
  2022-05-02 14:48 ` Borislav Petkov
@ 2022-05-02 15:50 ` tip-bot2 for Borislav Petkov
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Borislav Petkov @ 2022-05-02 15:50 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: kernel test robot, Borislav Petkov, x86, linux-kernel

The following commit has been merged into the x86/sev branch of tip:

Commit-ID:     ab65f49253ff706723ecbf87af74e9383b5e4582
Gitweb:        https://git.kernel.org/tip/ab65f49253ff706723ecbf87af74e9383b5e4582
Author:        Borislav Petkov <bp@suse.de>
AuthorDate:    Mon, 02 May 2022 17:33:40 +02:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 02 May 2022 17:34:29 +02:00

x86/sev: Fix address space sparse warning

Fix:

  arch/x86/kernel/sev.c:605:16: warning: incorrect type in assignment (different address spaces)
  arch/x86/kernel/sev.c:605:16:    expected struct snp_secrets_page_layout *layout
  arch/x86/kernel/sev.c:605:16:    got void [noderef] __iomem *[assigned] mem

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/202205022233.XgNDR7WR-lkp@intel.com
---
 arch/x86/kernel/sev.c |  9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
index 1663750..c05f012 100644
--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -589,20 +589,23 @@ static u64 __init get_secrets_page(void)
 static u64 __init get_snp_jump_table_addr(void)
 {
 	struct snp_secrets_page_layout *layout;
+	void __iomem *mem;
 	u64 pa, addr;
 
 	pa = get_secrets_page();
 	if (!pa)
 		return 0;
 
-	layout = (__force void *)ioremap_encrypted(pa, PAGE_SIZE);
-	if (!layout) {
+	mem = ioremap_encrypted(pa, PAGE_SIZE);
+	if (!mem) {
 		pr_err("Unable to locate AP jump table address: failed to map the SNP secrets page.\n");
 		return 0;
 	}
 
+	layout = (__force struct snp_secrets_page_layout *)mem;
+
 	addr = layout->os_area.ap_jump_table_pa;
-	iounmap(layout);
+	iounmap(mem);
 
 	return addr;
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-02 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 14:19 [tip:x86/sev 55/55] arch/x86/kernel/sev.c:605:17: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
2022-05-02 14:48 ` Borislav Petkov
2022-05-02 15:50 ` [tip: x86/sev] x86/sev: Fix address space sparse warning tip-bot2 for Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).