From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============4004827114267337458==" MIME-Version: 1.0 From: kbuild test robot To: kbuild-all@lists.01.org Subject: [joro:sev-es-client-v5.7-rc2 39/74] arch/x86/kernel/sev-es.c:77:21: sparse: sparse: incorrect type in argument 1 (different address spaces) Date: Sun, 26 Apr 2020 06:12:13 +0800 Message-ID: <202004260610.Aw50UDC4%lkp@intel.com> List-Id: --===============4004827114267337458== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable tree: https://git.kernel.org/pub/scm/linux/kernel/git/joro/linux.git sev-= es-client-v5.7-rc2 head: d145adbc6f48a45af59f5878a14d7ac5af86a707 commit: bd69b0258960348142fb2db49cbf9be6b2ccde9f [39/74] x86/sev-es: Compil= e early handler code into kernel image reproduce: # apt-get install sparse # sparse version: v0.6.1-191-gc51a0382-dirty git checkout bd69b0258960348142fb2db49cbf9be6b2ccde9f make ARCH=3Dx86_64 allmodconfig make C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) >> arch/x86/kernel/sev-es.c:77:21: sparse: sparse: incorrect type in argume= nt 1 (different address spaces) @@ expected void const volatile [noderef= ] * @@ got eref] * @@ arch/x86/kernel/sev-es.c:77:21: sparse: expected void const volatile = [noderef] * arch/x86/kernel/sev-es.c:77:21: sparse: got unsigned char *target arch/x86/kernel/sev-es.c:82:21: sparse: sparse: incorrect type in argume= nt 1 (different address spaces) @@ expected void const volatile [noderef= ] * @@ got eref] * @@ arch/x86/kernel/sev-es.c:82:21: sparse: expected void const volatile = [noderef] * arch/x86/kernel/sev-es.c:82:21: sparse: got unsigned char *target arch/x86/kernel/sev-es.c:87:21: sparse: sparse: incorrect type in argume= nt 1 (different address spaces) @@ expected void const volatile [noderef= ] * @@ got eref] * @@ arch/x86/kernel/sev-es.c:87:21: sparse: expected void const volatile = [noderef] * arch/x86/kernel/sev-es.c:87:21: sparse: got unsigned char *target arch/x86/kernel/sev-es.c:92:21: sparse: sparse: incorrect type in argume= nt 1 (different address spaces) @@ expected void const volatile [noderef= ] * @@ got eref] * @@ arch/x86/kernel/sev-es.c:92:21: sparse: expected void const volatile = [noderef] * arch/x86/kernel/sev-es.c:92:21: sparse: got unsigned char *target >> arch/x86/kernel/sev-es.c:124:21: sparse: sparse: incorrect type in argum= ent 1 (different address spaces) @@ expected void const volatile [nodere= f] * @@ got n:1> * @@ arch/x86/kernel/sev-es.c:124:21: sparse: expected void const volatile= [noderef] * arch/x86/kernel/sev-es.c:124:21: sparse: got char *src arch/x86/kernel/sev-es.c:129:21: sparse: sparse: incorrect type in argum= ent 1 (different address spaces) @@ expected void const volatile [nodere= f] * @@ got n:1> * @@ arch/x86/kernel/sev-es.c:129:21: sparse: expected void const volatile= [noderef] * arch/x86/kernel/sev-es.c:129:21: sparse: got char *src arch/x86/kernel/sev-es.c:134:21: sparse: sparse: incorrect type in argum= ent 1 (different address spaces) @@ expected void const volatile [nodere= f] * @@ got n:1> * @@ arch/x86/kernel/sev-es.c:134:21: sparse: expected void const volatile= [noderef] * arch/x86/kernel/sev-es.c:134:21: sparse: got char *src arch/x86/kernel/sev-es.c:139:21: sparse: sparse: incorrect type in argum= ent 1 (different address spaces) @@ expected void const volatile [nodere= f] * @@ got n:1> * @@ arch/x86/kernel/sev-es.c:139:21: sparse: expected void const volatile= [noderef] * arch/x86/kernel/sev-es.c:139:21: sparse: got char *src vim +77 arch/x86/kernel/sev-es.c 63 = 64 static enum es_result vc_write_mem(struct es_em_ctxt *ctxt, 65 char *dst, char *buf, size_t size) 66 { 67 unsigned long error_code =3D X86_PF_PROT | X86_PF_WRITE; 68 unsigned char *target =3D dst; 69 u64 d8; 70 u32 d4; 71 u16 d2; 72 u8 d1; 73 = 74 switch (size) { 75 case 1: 76 memcpy(&d1, buf, 1); > 77 if (put_user(d1, target)) 78 goto fault; 79 break; 80 case 2: 81 memcpy(&d2, buf, 2); > 82 if (put_user(d2, target)) 83 goto fault; 84 break; 85 case 4: 86 memcpy(&d4, buf, 4); 87 if (put_user(d4, target)) 88 goto fault; 89 break; 90 case 8: 91 memcpy(&d8, buf, 8); 92 if (put_user(d8, target)) 93 goto fault; 94 break; 95 default: 96 WARN_ONCE(1, "%s: Invalid size: %zu\n", __func__, size); 97 return ES_UNSUPPORTED; 98 } 99 = 100 return ES_OK; 101 = 102 fault: 103 if (user_mode(ctxt->regs)) 104 error_code |=3D X86_PF_USER; 105 = 106 ctxt->fi.vector =3D X86_TRAP_PF; 107 ctxt->fi.error_code =3D error_code; 108 ctxt->fi.cr2 =3D (unsigned long)dst; 109 = 110 return ES_EXCEPTION; 111 } 112 = 113 static enum es_result vc_read_mem(struct es_em_ctxt *ctxt, 114 char *src, char *buf, size_t size) 115 { 116 unsigned long error_code =3D X86_PF_PROT; 117 u64 d8; 118 u32 d4; 119 u16 d2; 120 u8 d1; 121 = 122 switch (size) { 123 case 1: > 124 if (get_user(d1, src)) 125 goto fault; 126 memcpy(buf, &d1, 1); 127 break; 128 case 2: 129 if (get_user(d2, src)) 130 goto fault; 131 memcpy(buf, &d2, 2); 132 break; 133 case 4: 134 if (get_user(d4, src)) 135 goto fault; 136 memcpy(buf, &d4, 4); 137 break; 138 case 8: 139 if (get_user(d8, src)) 140 goto fault; 141 memcpy(buf, &d8, 8); 142 break; 143 default: 144 WARN_ONCE(1, "%s: Invalid size: %zu\n", __func__, size); 145 return ES_UNSUPPORTED; 146 } 147 = 148 return ES_OK; 149 = 150 fault: 151 if (user_mode(ctxt->regs)) 152 error_code |=3D X86_PF_USER; 153 = 154 ctxt->fi.vector =3D X86_TRAP_PF; 155 ctxt->fi.error_code =3D error_code; 156 ctxt->fi.cr2 =3D (unsigned long)src; 157 = 158 return ES_EXCEPTION; 159 } 160 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============4004827114267337458==--