Hi Al, Thank you for the patch! Yet something to improve: [auto build test ERROR on sparc/master] [also build test ERROR on powerpc/next linus/master v5.8-rc3 next-20200701] [cannot apply to tip/x86/core sparc-next/master] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Al-Viro/introduction-of-regset-get-wrappers-switching-ELF-coredumps-to-those/20200630-053337 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git master config: sparc-randconfig-s032-20200701 (attached as .config) compiler: sparc-linux-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.2-3-gfa153962-dirty # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): arch/sparc/kernel/ptrace_32.c: In function 'setregs_set': >> arch/sparc/kernel/ptrace_32.c:320:6: error: variable 'ret' set but not used [-Werror=unused-but-set-variable] 320 | int ret; | ^~~ arch/sparc/kernel/ptrace_32.c: In function 'arch_ptrace': >> arch/sparc/kernel/ptrace_32.c:430:33: error: variable 'view' set but not used [-Werror=unused-but-set-variable] 430 | const struct user_regset_view *view; | ^~~~ cc1: all warnings being treated as errors vim +/ret +320 arch/sparc/kernel/ptrace_32.c 312 313 static int setregs_set(struct task_struct *target, 314 const struct user_regset *regset, 315 unsigned int pos, unsigned int count, 316 const void *kbuf, const void __user *ubuf) 317 { 318 struct pt_regs *regs = target->thread.kregs; 319 u32 v[4]; > 320 int ret; 321 322 if (target == current) 323 flush_user_windows(); 324 325 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 326 v, 327 0, 4 * sizeof(u32)); 328 regs->psr = (regs->psr & ~(PSR_ICC | PSR_SYSCALL)) | 329 (v[0] & (PSR_ICC | PSR_SYSCALL)); 330 regs->pc = v[1]; 331 regs->npc = v[2]; 332 regs->y = v[3]; 333 return user_regset_copyin(&pos, &count, &kbuf, &ubuf, 334 regs->u_regs + 1, 335 4 * sizeof(u32) , 19 * sizeof(u32)); 336 } 337 338 static int getfpregs_get(struct task_struct *target, 339 const struct user_regset *regset, 340 unsigned int pos, unsigned int count, 341 void *kbuf, void __user *ubuf) 342 { 343 const unsigned long *fpregs = target->thread.float_regs; 344 int ret = 0; 345 346 #if 0 347 if (target == current) 348 save_and_clear_fpu(); 349 #endif 350 351 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 352 fpregs, 353 0, 32 * sizeof(u32)); 354 if (ret) 355 return ret; 356 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 357 &target->thread.fsr, 358 32 * sizeof(u32), 33 * sizeof(u32)); 359 if (ret) 360 return ret; 361 return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, 362 33 * sizeof(u32), 68 * sizeof(u32)); 363 } 364 365 static int setfpregs_set(struct task_struct *target, 366 const struct user_regset *regset, 367 unsigned int pos, unsigned int count, 368 const void *kbuf, const void __user *ubuf) 369 { 370 unsigned long *fpregs = target->thread.float_regs; 371 int ret; 372 373 #if 0 374 if (target == current) 375 save_and_clear_fpu(); 376 #endif 377 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 378 fpregs, 379 0, 32 * sizeof(u32)); 380 if (ret) 381 return ret; 382 return user_regset_copyin(&pos, &count, &kbuf, &ubuf, 383 &target->thread.fsr, 384 32 * sizeof(u32), 385 33 * sizeof(u32)); 386 } 387 388 static const struct user_regset ptrace32_regsets[] = { 389 [REGSET_GENERAL] = { 390 .n = 19, .size = sizeof(u32), 391 .get = getregs_get, .set = setregs_set, 392 }, 393 [REGSET_FP] = { 394 .n = 68, .size = sizeof(u32), 395 .get = getfpregs_get, .set = setfpregs_set, 396 }, 397 }; 398 399 static const struct user_regset_view ptrace32_view = { 400 .regsets = ptrace32_regsets, .n = ARRAY_SIZE(ptrace32_regsets) 401 }; 402 403 static const struct user_regset_view user_sparc32_view = { 404 .name = "sparc", .e_machine = EM_SPARC, 405 .regsets = sparc32_regsets, .n = ARRAY_SIZE(sparc32_regsets) 406 }; 407 408 const struct user_regset_view *task_user_regset_view(struct task_struct *task) 409 { 410 return &user_sparc32_view; 411 } 412 413 struct fps { 414 unsigned long regs[32]; 415 unsigned long fsr; 416 unsigned long flags; 417 unsigned long extra; 418 unsigned long fpqd; 419 struct fq { 420 unsigned long *insnaddr; 421 unsigned long insn; 422 } fpq[16]; 423 }; 424 425 long arch_ptrace(struct task_struct *child, long request, 426 unsigned long addr, unsigned long data) 427 { 428 unsigned long addr2 = current->thread.kregs->u_regs[UREG_I4]; 429 void __user *addr2p; > 430 const struct user_regset_view *view; 431 struct pt_regs __user *pregs; 432 struct fps __user *fps; 433 int ret; 434 435 view = task_user_regset_view(current); 436 addr2p = (void __user *) addr2; 437 pregs = (struct pt_regs __user *) addr; 438 fps = (struct fps __user *) addr; 439 440 switch(request) { 441 case PTRACE_GETREGS: { 442 ret = copy_regset_to_user(child, &ptrace32_view, 443 REGSET_GENERAL, 0, 444 19 * sizeof(u32), 445 pregs); 446 break; 447 } 448 449 case PTRACE_SETREGS: { 450 ret = copy_regset_from_user(child, &ptrace32_view, 451 REGSET_GENERAL, 0, 452 19 * sizeof(u32), 453 pregs); 454 break; 455 } 456 457 case PTRACE_GETFPREGS: { 458 ret = copy_regset_to_user(child, &ptrace32_view, 459 REGSET_FP, 0, 460 68 * sizeof(u32), 461 fps); 462 break; 463 } 464 465 case PTRACE_SETFPREGS: { 466 ret = copy_regset_from_user(child, &ptrace32_view, 467 REGSET_FP, 0, 468 33 * sizeof(u32), 469 fps); 470 break; 471 } 472 473 case PTRACE_READTEXT: 474 case PTRACE_READDATA: 475 ret = ptrace_readdata(child, addr, addr2p, data); 476 477 if (ret == data) 478 ret = 0; 479 else if (ret >= 0) 480 ret = -EIO; 481 break; 482 483 case PTRACE_WRITETEXT: 484 case PTRACE_WRITEDATA: 485 ret = ptrace_writedata(child, addr2p, addr, data); 486 487 if (ret == data) 488 ret = 0; 489 else if (ret >= 0) 490 ret = -EIO; 491 break; 492 493 default: 494 if (request == PTRACE_SPARC_DETACH) 495 request = PTRACE_DETACH; 496 ret = ptrace_request(child, request, addr, data); 497 break; 498 } 499 500 return ret; 501 } 502 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org