Skip to contentSkip to conversation

serial: ns16550_pci: fix possible read of uninitialized variable

PATCH Applied Ahmad Fatoum 2 participants 2 messages Feb 12, 2020 – Feb 14, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: ns16550_pci: fix possible read of uninitialized variable

When quirk->init is NULL, we evaluate an uninitialized rc. Is we have already checked for rc < 0 at the point of assignment, this if clause isn't needed. Remove it.

---
 drivers/serial/serial_ns16550_pci.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/serial/serial_ns16550_pci.c +0 -6
index d4b5bd8898b7..392a2810d815 100644
@@ -3655,12 +3655,6 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
 	uart.pdata = xzalloc(sizeof(*uart.pdata));
 	uart.pdata->clock = board->base_baud * 16;
 
-	if (rc < 0) {
-		kfree(priv);
-		priv = ERR_PTR(rc);
-		goto err_deinit;
-	}
-
 	for (i = 0; i < nr_ports; i++) {
 		struct device_d *ns16550_dev;
 		struct resource *res;
Signature · 7 lines
2.20.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 8 lines · Ahmad Fatoum

When quirk->init is NULL, we evaluate an uninitialized rc. Is we have already checked for rc < 0 at the point of assignment, this if clause isn't needed. Remove it.

---
 drivers/serial/serial_ns16550_pci.c | 6 ------
 1 file changed, 6 deletions(-)

Applied, thanks

Sascha

Quoted 27 lines
drivers/serial/serial_ns16550_pci.c +0 -6
index d4b5bd8898b7..392a2810d815 100644
@@ -3655,12 +3655,6 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
 	uart.pdata = xzalloc(sizeof(*uart.pdata));
 	uart.pdata->clock = board->base_baud * 16;
 
-	if (rc < 0) {
-		kfree(priv);
-		priv = ERR_PTR(rc);
-		goto err_deinit;
-	}
-
 	for (i = 0; i < nr_ports; i++) {
 		struct device_d *ns16550_dev;
 		struct resource *res;
Signature · 7 lines
2.20.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox