* [opencloudos:next 6548/6577] drivers/crypto/ccp/hygon/csv-dev.c:141:29: sparse: sparse: incorrect type in argument 2 (different address spaces)
@ 2024-05-08 8:57 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-05-08 8:57 UTC (permalink / raw)
To: jasperwang, kaixuxia, frankjpliu, kasong, sagazchen, kernelxing,
aurelianliu, jason.zeng, wu.zheng, yingbao.jia, pei.p.jia
Cc: oe-kbuild-all
tree: https://gitee.com/OpenCloudOS/OpenCloudOS-Kernel.git next
head: ffca8a908fafd64ef6729c1f9953adc81cd5ffe1
commit: a90e977db157287a8a9766dc190bac769b7bc8d6 [6548/6577] crypto: ccp: Implement CSV_DOWNLOAD_FIRMWARE ioctl command
config: x86_64-randconfig-123-20240508 (https://download.01.org/0day-ci/archive/20240508/202405081647.fZcWhmJf-lkp@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240508/202405081647.fZcWhmJf-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/202405081647.fZcWhmJf-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/crypto/ccp/hygon/csv-dev.c:141:29: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got void * @@
drivers/crypto/ccp/hygon/csv-dev.c:141:29: sparse: expected void const [noderef] __user *from
drivers/crypto/ccp/hygon/csv-dev.c:141:29: sparse: got void *
drivers/crypto/ccp/hygon/csv-dev.c: note: in included file (through include/linux/mmzone.h, include/linux/gfp.h, include/linux/mm.h, ...):
include/linux/page-flags.h:242:46: sparse: sparse: self-comparison always evaluates to false
vim +141 drivers/crypto/ccp/hygon/csv-dev.c
93
94 static int csv_ioctl_do_download_firmware(struct sev_issue_cmd *argp)
95 {
96 struct sev_data_download_firmware *data = NULL;
97 struct csv_user_data_download_firmware input;
98 int ret, order;
99 struct page *p;
100 u64 data_size;
101
102 /* Only support DOWNLOAD_FIRMWARE if build greater or equal 1667 */
103 if (!csv_version_greater_or_equal(1667)) {
104 pr_err("DOWNLOAD_FIRMWARE not supported\n");
105 return -EIO;
106 }
107
108 if (copy_from_user(&input, (void __user *)argp->data, sizeof(input)))
109 return -EFAULT;
110
111 if (!input.address) {
112 argp->error = SEV_RET_INVALID_ADDRESS;
113 return -EINVAL;
114 }
115
116 if (!input.length || input.length > CSV_FW_MAX_SIZE) {
117 argp->error = SEV_RET_INVALID_LEN;
118 return -EINVAL;
119 }
120
121 /*
122 * CSV FW expects the physical address given to it to be 32
123 * byte aligned. Memory allocated has structure placed at the
124 * beginning followed by the firmware being passed to the CSV
125 * FW. Allocate enough memory for data structure + alignment
126 * padding + CSV FW.
127 */
128 data_size = ALIGN(sizeof(struct sev_data_download_firmware), 32);
129
130 order = get_order(input.length + data_size);
131 p = alloc_pages(GFP_KERNEL, order);
132 if (!p)
133 return -ENOMEM;
134
135 /*
136 * Copy firmware data to a kernel allocated contiguous
137 * memory region.
138 */
139 data = page_address(p);
140 if (copy_from_user((void *)(page_address(p) + data_size),
> 141 (void *)input.address, input.length)) {
142 ret = -EFAULT;
143 goto err_free_page;
144 }
145
146 data->address = __psp_pa(page_address(p) + data_size);
147 data->len = input.length;
148
149 ret = hygon_psp_hooks.__sev_do_cmd_locked(SEV_CMD_DOWNLOAD_FIRMWARE,
150 data, &argp->error);
151 if (ret)
152 pr_err("Failed to update CSV firmware: %#x\n", argp->error);
153 else
154 pr_info("CSV firmware update successful\n");
155
156 err_free_page:
157 __free_pages(p, order);
158
159 return ret;
160 }
161
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-08 8:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-08 8:57 [opencloudos:next 6548/6577] drivers/crypto/ccp/hygon/csv-dev.c:141:29: sparse: sparse: incorrect type in argument 2 (different address spaces) kernel test robot
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).