* [vfs:regset.sparc 4/5] arch/sparc/kernel/ptrace_32.c:320:6: error: variable 'ret' set but not used
@ 2020-06-29 23:29 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-06-29 23:29 UTC (permalink / raw)
To: Al Viro; +Cc: kbuild-all, linux-fsdevel
[-- Attachment #1: Type: text/plain, Size: 7222 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git regset.sparc
head: 9a5f61635dbb139673402d2c556f7dde6c73f55c
commit: 135142ffb5b0ed417ab394cb63ddfb57da674182 [4/5] sparc32: get rid of odd callers of copy_regset_from_user()
config: sparc-defconfig (attached as .config)
compiler: sparc-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 135142ffb5b0ed417ab394cb63ddfb57da674182
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
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@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 13159 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-29 23:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-29 23:29 [vfs:regset.sparc 4/5] arch/sparc/kernel/ptrace_32.c:320:6: error: variable 'ret' set but not used 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).