lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6fc4ab6f-1168-d362-6a92-7d79b90489a2@users.sourceforge.net>
Date:   Fri, 16 Feb 2018 15:23:53 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-ide@...r.kernel.org,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Tejun Heo <tj@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 2/2] pata_it821x: Use common error handling code in
 it821x_firmware_command()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Fri, 16 Feb 2018 14:40:42 +0100

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

Reorder three function calls.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/ata/pata_it821x.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 46eacb6b93dd..6470112e5b48 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -675,9 +675,8 @@ static u8 *it821x_firmware_command(struct ata_port *ap, u8 cmd, int len)
 	while(n++ < 10) {
 		status = ioread8(ap->ioaddr.status_addr);
 		if (status & ATA_ERR) {
-			kfree(buf);
 			printk(KERN_ERR "it821x_firmware_command: rejected\n");
-			return NULL;
+			goto free_buffer;
 		}
 		if (status & ATA_DRQ) {
 			ioread16_rep(ap->ioaddr.data_addr, buf, len/2);
@@ -687,6 +686,8 @@ static u8 *it821x_firmware_command(struct ata_port *ap, u8 cmd, int len)
 	}
-	kfree(buf);
+
 	printk(KERN_ERR "it821x_firmware_command: timeout\n");
+free_buffer:
+	kfree(buf);
 	return NULL;
 }
 
-- 
2.16.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ