]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
test_firmware: fix error return getting clobbered
authorColin Ian King <colin.king@canonical.com>
Fri, 19 Oct 2018 12:58:01 +0000 (13:58 +0100)
committerSultan Alsawaf <sultan.alsawaf@canonical.com>
Wed, 24 Jul 2019 15:45:03 +0000 (09:45 -0600)
BugLink: https://bugs.launchpad.net/bugs/1837161
[ Upstream commit 8bb0a88600f0267cfcc245d34f8c4abe8c282713 ]

In the case where eq->fw->size > PAGE_SIZE the error return rc
is being set to EINVAL however this is being overwritten to
rc = req->fw->size because the error exit path via label 'out' is
not being taken.  Fix this by adding the jump to the error exit
path 'out'.

Detected by CoverityScan, CID#1453465 ("Unused value")

Fixes: c92316bf8e94 ("test_firmware: add batched firmware tests")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
lib/test_firmware.c

index 464764772adc4a23628f9c744a431e2371921be3..1aa58906863ba33c109abd4ae8cc73b823c357cb 100644 (file)
@@ -834,6 +834,7 @@ static ssize_t read_firmware_show(struct device *dev,
        if (req->fw->size > PAGE_SIZE) {
                pr_err("Testing interface must use PAGE_SIZE firmware for now\n");
                rc = -EINVAL;
+               goto out;
        }
        memcpy(buf, req->fw->data, req->fw->size);