From: Markus Elfring <elfr...@users.sourceforge.net> Date: Sat, 21 Jan 2017 18:10:57 +0100
A local variable was set to an error code before a concrete error situation was detected. Thus move the corresponding assignments into if branches to indicate a software failure there. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net> --- arch/s390/pci/pci_clp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c index 28e13fa7a79c..bde0291cc724 100644 --- a/arch/s390/pci/pci_clp.c +++ b/arch/s390/pci/pci_clp.c @@ -521,14 +521,16 @@ static int clp_normal_command(struct clp_req *req) if (!lpcb) return -ENOMEM; - rc = -EFAULT; uptr = (void __force __user *)(unsigned long) req->data_p; - if (copy_from_user(lpcb, uptr, PAGE_SIZE) != 0) + if (copy_from_user(lpcb, uptr, PAGE_SIZE) != 0) { + rc = -EFAULT; goto out_free; + } - rc = -EINVAL; - if (lpcb->fmt != 0 || lpcb->reserved1 != 0 || lpcb->reserved2 != 0) + if (lpcb->fmt != 0 || lpcb->reserved1 != 0 || lpcb->reserved2 != 0) { + rc = -EINVAL; goto out_free; + } switch (req->lps) { case 0: @@ -541,9 +543,8 @@ static int clp_normal_command(struct clp_req *req) if (rc) goto out_free; - rc = -EFAULT; if (copy_to_user(uptr, lpcb, PAGE_SIZE) != 0) - goto out_free; + rc = -EFAULT; rc = 0; -- 2.11.0