tree: https://github.com/l1k/linux doe head: b87b6cc6dd01b2b23f1413ffd69f742b1cc58f16 commit: 89777d2e5c643bc1664cc7a95323affd0a967137 [3/8] PCI/DOE: Relax restrictions on request and response size config: i386-randconfig-a001 compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce (this is a W=1 build): # https://github.com/l1k/linux/commit/89777d2e5c643bc1664cc7a95323affd0a967137 git remote add l1k https://github.com/l1k/linux git fetch --no-tags l1k doe git checkout 89777d2e5c643bc1664cc7a95323affd0a967137 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): 498 | __member_size(p), __member_size(q), \ | ^~~~~~~~~~~~~ drivers/pci/doe.c:188:17: note: in expansion of macro 'memcpy' 188 | memcpy(val, &task->request_pl[i], remainder); | ^~~~~~ In file included from arch/x86/include/asm/bug.h:87, from include/linux/bug.h:5, from include/linux/thread_info.h:13, from arch/x86/include/asm/preempt.h:7, from include/linux/preempt.h:78, from include/linux/rcupdate.h:27, from include/linux/rculist.h:11, from include/linux/pid.h:5, from include/linux/sched.h:14, from include/linux/delay.h:23, from drivers/pci/doe.c:16: drivers/pci/doe.c:188:24: warning: passing argument 1 of '__builtin_object_size' makes pointer from integer without a cast [-Wint-conversion] 188 | memcpy(val, &task->request_pl[i], remainder); | ^~~ | | | u32 {aka unsigned int} include/asm-generic/bug.h:105:31: note: in definition of macro '__WARN_printf' 105 | __warn_printk(arg); \ | ^~~ include/linux/once_lite.h:31:25: note: in expansion of macro 'WARN' 31 | func(__VA_ARGS__); \ | ^~~~ include/asm-generic/bug.h:151:9: note: in expansion of macro 'DO_ONCE_LITE_IF' 151 | DO_ONCE_LITE_IF(condition, WARN, 1, format) | ^~~~~~~~~~~~~~~ include/linux/fortify-string.h:445:9: note: in expansion of macro 'WARN_ONCE' 445 | WARN_ONCE(fortify_memcpy_chk(__fortify_size, p_size, q_size, \ | ^~~~~~~~~ include/linux/fortify-string.h:496:26: note: in expansion of macro '__fortify_memcpy_chk' 496 | #define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \ | ^~~~~~~~~~~~~~~~~~~~ include/linux/fortify-string.h:498:17: note: in expansion of macro '__member_size' 498 | __member_size(p), __member_size(q), \ | ^~~~~~~~~~~~~ drivers/pci/doe.c:188:17: note: in expansion of macro 'memcpy' 188 | memcpy(val, &task->request_pl[i], remainder); | ^~~~~~ drivers/pci/doe.c:188:24: note: expected 'const void *' but argument is of type 'u32' {aka 'unsigned int'} 188 | memcpy(val, &task->request_pl[i], remainder); | ^~~ include/asm-generic/bug.h:105:31: note: in definition of macro '__WARN_printf' 105 | __warn_printk(arg); \ | ^~~ include/linux/once_lite.h:31:25: note: in expansion of macro 'WARN' 31 | func(__VA_ARGS__); \ | ^~~~ include/asm-generic/bug.h:151:9: note: in expansion of macro 'DO_ONCE_LITE_IF' 151 | DO_ONCE_LITE_IF(condition, WARN, 1, format) | ^~~~~~~~~~~~~~~ include/linux/fortify-string.h:445:9: note: in expansion of macro 'WARN_ONCE' 445 | WARN_ONCE(fortify_memcpy_chk(__fortify_size, p_size, q_size, \ | ^~~~~~~~~ include/linux/fortify-string.h:496:26: note: in expansion of macro '__fortify_memcpy_chk' 496 | #define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \ | ^~~~~~~~~~~~~~~~~~~~ include/linux/fortify-string.h:498:17: note: in expansion of macro '__member_size' 498 | __member_size(p), __member_size(q), \ | ^~~~~~~~~~~~~ drivers/pci/doe.c:188:17: note: in expansion of macro 'memcpy' 188 | memcpy(val, &task->request_pl[i], remainder); | ^~~~~~ In file included from include/linux/string.h:253, from arch/x86/include/asm/page_32.h:22, from arch/x86/include/asm/page.h:14, from arch/x86/include/asm/thread_info.h:12, from include/linux/thread_info.h:60, from arch/x86/include/asm/preempt.h:7, from include/linux/preempt.h:78, from include/linux/rcupdate.h:27, from include/linux/rculist.h:11, from include/linux/pid.h:5, from include/linux/sched.h:14, from include/linux/delay.h:23, from drivers/pci/doe.c:16: drivers/pci/doe.c:188:24: warning: passing argument 1 of '__builtin_memcpy' makes pointer from integer without a cast [-Wint-conversion] 188 | memcpy(val, &task->request_pl[i], remainder); | ^~~ | | | u32 {aka unsigned int} include/linux/fortify-string.h:451:27: note: in definition of macro '__fortify_memcpy_chk' 451 | __underlying_##op(p, q, __fortify_size); \ | ^ drivers/pci/doe.c:188:17: note: in expansion of macro 'memcpy' 188 | memcpy(val, &task->request_pl[i], remainder); | ^~~~~~ drivers/pci/doe.c:188:24: note: expected 'void *' but argument is of type 'u32' {aka 'unsigned int'} 188 | memcpy(val, &task->request_pl[i], remainder); | ^~~ include/linux/fortify-string.h:451:27: note: in definition of macro '__fortify_memcpy_chk' 451 | __underlying_##op(p, q, __fortify_size); \ | ^ drivers/pci/doe.c:188:17: note: in expansion of macro 'memcpy' 188 | memcpy(val, &task->request_pl[i], remainder); | ^~~~~~ drivers/pci/doe.c: In function 'pci_doe_recv_resp': >> drivers/pci/doe.c:244:9: error: 'remainder' undeclared (first use in this function) 244 | remainder = task->response_pl_sz % sizeof(u32); | ^~~~~~~~~ drivers/pci/doe.c:244:9: note: each undeclared identifier is reported only once for each function it appears in vim +/remainder +244 drivers/pci/doe.c 208 209 static int pci_doe_recv_resp(struct pci_doe_mb *doe_mb, struct pci_doe_task *task) 210 { 211 struct pci_dev *pdev = doe_mb->pdev; 212 int offset = doe_mb->cap_offset; 213 size_t length, payload_length; 214 int ret, i = 0; 215 u32 val; 216 217 /* Read the first dword to get the protocol */ 218 pci_read_config_dword(pdev, offset + PCI_DOE_READ, &val); 219 if ((FIELD_GET(PCI_DOE_DATA_OBJECT_HEADER_1_VID, val) != task->prot.vid) || 220 (FIELD_GET(PCI_DOE_DATA_OBJECT_HEADER_1_TYPE, val) != task->prot.type)) { 221 dev_err_ratelimited(&pdev->dev, "[%x] expected [VID, Protocol] = [%04x, %02x], got [%04x, %02x]\n", 222 doe_mb->cap_offset, task->prot.vid, task->prot.type, 223 FIELD_GET(PCI_DOE_DATA_OBJECT_HEADER_1_VID, val), 224 FIELD_GET(PCI_DOE_DATA_OBJECT_HEADER_1_TYPE, val)); 225 return -EIO; 226 } 227 228 pci_write_config_dword(pdev, offset + PCI_DOE_READ, 0); 229 /* Read the second dword to get the length */ 230 pci_read_config_dword(pdev, offset + PCI_DOE_READ, &val); 231 pci_write_config_dword(pdev, offset + PCI_DOE_READ, 0); 232 233 length = FIELD_GET(PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH, val); 234 /* A value of 0x0 indicates max data object length */ 235 if (!length) 236 length = PCI_DOE_MAX_LENGTH; 237 if (length < 2) 238 return -EIO; 239 240 /* First 2 dwords have already been read */ 241 length -= 2; 242 ret = task->response_pl_sz; 243 payload_length = DIV_ROUND_UP(task->response_pl_sz, sizeof(u32)); > 244 remainder = task->response_pl_sz % sizeof(u32); 245 if (!remainder) 246 remainder = sizeof(u32); 247 248 if (length < payload_length) { 249 ret = length * sizeof(u32); 250 payload_length = length; 251 remainder = sizeof(u32); 252 } 253 254 /* Read the rest of the response payload */ 255 if (payload_length) { 256 for (i = 0; i < payload_length - 1; i++) { 257 pci_read_config_dword(pdev, offset + PCI_DOE_READ, 258 &task->response_pl[i]); 259 pci_write_config_dword(pdev, offset + PCI_DOE_READ, 0); 260 } 261 262 pci_read_config_dword(pdev, offset + PCI_DOE_READ, &val); 263 memcpy(&task->response_pl[i], &val, remainder); 264 /* Prior to the last ack, ensure Data Object Ready */ 265 if (!pci_doe_data_obj_ready(doe_mb)) 266 return -EIO; 267 pci_write_config_dword(pdev, offset + PCI_DOE_READ, 0); 268 i++; 269 } 270 271 /* Flush excess length */ 272 for (; i < length; i++) { 273 pci_read_config_dword(pdev, offset + PCI_DOE_READ, &val); 274 pci_write_config_dword(pdev, offset + PCI_DOE_READ, 0); 275 } 276 277 /* Final error check to pick up on any since Data Object Ready */ 278 pci_read_config_dword(pdev, offset + PCI_DOE_STATUS, &val); 279 if (FIELD_GET(PCI_DOE_STATUS_ERROR, val)) 280 return -EIO; 281 282 return ret; 283 } 284 -- 0-DAY CI Kernel Test Service https://01.org/lkp