arm64: ptrace: user_regset_copyin_ignore() always returns 0
authorSergey Shtylyov <s.shtylyov@omp.ru>
Fri, 14 Oct 2022 21:22:25 +0000 (00:22 +0300)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 15 Nov 2022 22:30:39 +0000 (14:30 -0800)
user_regset_copyin_ignore() always returns 0, so checking its result seems
pointless -- don't do this anymore...

Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.

Link: https://lkml.kernel.org/r/20221014212235.10770-4-s.shtylyov@omp.ru
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: Brian Cain <bcain@quicinc.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: David S. Miller <davem@davemloft.net>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rich Felker <dalias@libc.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Will Deacon <will@kernel.org>
Cc: Yoshinori Sato <ysato@users.osdn.me>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/arm64/kernel/ptrace.c

index c2fb5755bbecbde36117f27a6a6e0c52cca412f5..f3af3371280a96b5b01aefab2513c5f96598b1b0 100644 (file)
@@ -514,9 +514,7 @@ static int hw_break_set(struct task_struct *target,
 
        /* Resource info and pad */
        offset = offsetof(struct user_hwdebug_state, dbg_regs);
-       ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset);
-       if (ret)
-               return ret;
+       user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset);
 
        /* (address, ctrl) registers */
        limit = regset->n * regset->size;
@@ -543,11 +541,8 @@ static int hw_break_set(struct task_struct *target,
                        return ret;
                offset += PTRACE_HBP_CTRL_SZ;
 
-               ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-                                               offset,
-                                               offset + PTRACE_HBP_PAD_SZ);
-               if (ret)
-                       return ret;
+               user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
+                                         offset, offset + PTRACE_HBP_PAD_SZ);
                offset += PTRACE_HBP_PAD_SZ;
                idx++;
        }
@@ -954,10 +949,7 @@ static int sve_set_common(struct task_struct *target,
 
        start = end;
        end = SVE_PT_SVE_FPSR_OFFSET(vq);
-       ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-                                       start, end);
-       if (ret)
-               goto out;
+       user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, start, end);
 
        /*
         * Copy fpsr, and fpcr which must follow contiguously in