]> git.baikalelectronics.ru Git - kernel.git/commitdiff
parisc: Replace hardcoded value with PRIV_USER constant in ptrace.c
authorHelge Deller <deller@gmx.de>
Wed, 1 Feb 2023 10:04:06 +0000 (11:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:20 +0000 (11:28 +0100)
commit 3f0c17809a098d3f0c1ec83f1fb3ca61638d3dcd upstream.

Prefer usage of the PRIV_USER constant over the hard-coded value to set
the lowest 2 bits for the userspace privilege.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # 5.16+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/parisc/kernel/ptrace.c

index 96ef6a6b66e5644d3f6c8a6078b364b7f021b36e..79d654976ada7e3ddf6050e9c1f9bcb27f9c9abc 100644 (file)
@@ -166,7 +166,7 @@ long arch_ptrace(struct task_struct *child, long request,
                     addr >= sizeof(struct pt_regs))
                        break;
                if (addr == PT_IAOQ0 || addr == PT_IAOQ1) {
-                       data |= 3; /* ensure userspace privilege */
+                       data |= PRIV_USER; /* ensure userspace privilege */
                }
                if ((addr >= PT_GR1 && addr <= PT_GR31) ||
                                addr == PT_IAOQ0 || addr == PT_IAOQ1 ||
@@ -285,7 +285,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
                        if (addr >= sizeof(struct pt_regs))
                                break;
                        if (addr == PT_IAOQ0+4 || addr == PT_IAOQ1+4) {
-                               data |= 3; /* ensure userspace privilege */
+                               data |= PRIV_USER; /* ensure userspace privilege */
                        }
                        if (addr >= PT_FR0 && addr <= PT_FR31 + 4) {
                                /* Special case, fp regs are 64 bits anyway */
@@ -483,7 +483,7 @@ static void set_reg(struct pt_regs *regs, int num, unsigned long val)
        case RI(iaoq[0]):
        case RI(iaoq[1]):
                        /* set 2 lowest bits to ensure userspace privilege: */
-                       regs->iaoq[num - RI(iaoq[0])] = val | 3;
+                       regs->iaoq[num - RI(iaoq[0])] = val | PRIV_USER;
                        return;
        case RI(sar):   regs->sar = val;
                        return;