From: kbuild test robot <lkp@intel.com>
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 [thread overview]
Message-ID: <202004260610.Aw50UDC4%lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6161 bytes --]
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: Compile early handler code into kernel image
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-191-gc51a0382-dirty
git checkout bd69b0258960348142fb2db49cbf9be6b2ccde9f
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> arch/x86/kernel/sev-es.c:77:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got eref] <asn:1> * @@
arch/x86/kernel/sev-es.c:77:21: sparse: expected void const volatile [noderef] <asn:1> *
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 argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got eref] <asn:1> * @@
arch/x86/kernel/sev-es.c:82:21: sparse: expected void const volatile [noderef] <asn:1> *
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 argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got eref] <asn:1> * @@
arch/x86/kernel/sev-es.c:87:21: sparse: expected void const volatile [noderef] <asn:1> *
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 argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got eref] <asn:1> * @@
arch/x86/kernel/sev-es.c:92:21: sparse: expected void const volatile [noderef] <asn:1> *
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 argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got n:1> * @@
arch/x86/kernel/sev-es.c:124:21: sparse: expected void const volatile [noderef] <asn:1> *
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 argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got n:1> * @@
arch/x86/kernel/sev-es.c:129:21: sparse: expected void const volatile [noderef] <asn:1> *
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 argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got n:1> * @@
arch/x86/kernel/sev-es.c:134:21: sparse: expected void const volatile [noderef] <asn:1> *
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 argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got n:1> * @@
arch/x86/kernel/sev-es.c:139:21: sparse: expected void const volatile [noderef] <asn:1> *
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 = X86_PF_PROT | X86_PF_WRITE;
68 unsigned char *target = 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 |= X86_PF_USER;
105
106 ctxt->fi.vector = X86_TRAP_PF;
107 ctxt->fi.error_code = error_code;
108 ctxt->fi.cr2 = (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 = 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 |= X86_PF_USER;
153
154 ctxt->fi.vector = X86_TRAP_PF;
155 ctxt->fi.error_code = error_code;
156 ctxt->fi.cr2 = (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
reply other threads:[~2020-04-25 22:12 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=202004260610.Aw50UDC4%lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/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.