Re: [PATCH] powerpc/ptrace: Split gpr32_set_common

From: kernel test robot
Date: Wed Jun 21 2023 - 07:58:24 EST


Hi Christophe,

kernel test robot noticed the following build errors:

[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes linus/master v6.4-rc7 next-20230621]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Christophe-Leroy/powerpc-ptrace-Split-gpr32_set_common/20230621-183932
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/3086d189fa629e6c7bf800832921669450cc09bf.1687343697.git.christophe.leroy%40csgroup.eu
patch subject: [PATCH] powerpc/ptrace: Split gpr32_set_common
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20230621/202306211940.y4kIhSei-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230621/202306211940.y4kIhSei-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306211940.y4kIhSei-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> arch/powerpc/kernel/ptrace/ptrace-view.c:719:5: error: no previous prototype for 'gpr32_set_common_kernel' [-Werror=missing-prototypes]
719 | int gpr32_set_common_kernel(struct task_struct *target,
| ^~~~~~~~~~~~~~~~~~~~~~~
>> arch/powerpc/kernel/ptrace/ptrace-view.c:757:5: error: no previous prototype for 'gpr32_set_common_user' [-Werror=missing-prototypes]
757 | int gpr32_set_common_user(struct task_struct *target,
| ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


vim +/gpr32_set_common_kernel +719 arch/powerpc/kernel/ptrace/ptrace-view.c

718
> 719 int gpr32_set_common_kernel(struct task_struct *target,
720 const struct user_regset *regset,
721 unsigned int pos, unsigned int count,
722 const void *kbuf, unsigned long *regs)
723 {
724 const compat_ulong_t *k = kbuf;
725
726 pos /= sizeof(compat_ulong_t);
727 count /= sizeof(compat_ulong_t);
728
729 for (; count > 0 && pos < PT_MSR; --count)
730 regs[pos++] = *k++;
731
732 if (count > 0 && pos == PT_MSR) {
733 set_user_msr(target, *k++);
734 ++pos;
735 --count;
736 }
737
738 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count)
739 regs[pos++] = *k++;
740 for (; count > 0 && pos < PT_TRAP; --count, ++pos)
741 ++k;
742
743 if (count > 0 && pos == PT_TRAP) {
744 set_user_trap(target, *k++);
745 ++pos;
746 --count;
747 }
748
749 kbuf = k;
750 pos *= sizeof(compat_ulong_t);
751 count *= sizeof(compat_ulong_t);
752 user_regset_copyin_ignore(&pos, &count, &kbuf, NULL,
753 (PT_TRAP + 1) * sizeof(compat_ulong_t), -1);
754 return 0;
755 }
756
> 757 int gpr32_set_common_user(struct task_struct *target,
758 const struct user_regset *regset,
759 unsigned int pos, unsigned int count,
760 const void __user *ubuf, unsigned long *regs)
761 {
762 const compat_ulong_t __user *u = ubuf;
763 compat_ulong_t reg;
764
765 if (!user_read_access_begin(u, count))
766 return -EFAULT;
767
768 pos /= sizeof(reg);
769 count /= sizeof(reg);
770
771 for (; count > 0 && pos < PT_MSR; --count) {
772 unsafe_get_user(reg, u++, Efault);
773 regs[pos++] = reg;
774 }
775
776 if (count > 0 && pos == PT_MSR) {
777 unsafe_get_user(reg, u++, Efault);
778 set_user_msr(target, reg);
779 ++pos;
780 --count;
781 }
782
783 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) {
784 unsafe_get_user(reg, u++, Efault);
785 regs[pos++] = reg;
786 }
787 for (; count > 0 && pos < PT_TRAP; --count, ++pos)
788 unsafe_get_user(reg, u++, Efault);
789
790 if (count > 0 && pos == PT_TRAP) {
791 unsafe_get_user(reg, u++, Efault);
792 set_user_trap(target, reg);
793 ++pos;
794 --count;
795 }
796 user_read_access_end();
797
798 ubuf = u;
799 pos *= sizeof(reg);
800 count *= sizeof(reg);
801 user_regset_copyin_ignore(&pos, &count, NULL, &ubuf,
802 (PT_TRAP + 1) * sizeof(reg), -1);
803 return 0;
804
805 Efault:
806 user_read_access_end();
807 return -EFAULT;
808 }
809

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki