mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] serial: ns16550_pci: fix possible read of uninitialized variable
@ 2020-02-12  9:38 Ahmad Fatoum
  2020-02-14  7:44 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2020-02-12  9:38 UTC (permalink / raw)
  To: barebox

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.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/serial/serial_ns16550_pci.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/serial/serial_ns16550_pci.c b/drivers/serial/serial_ns16550_pci.c
index d4b5bd8898b7..392a2810d815 100644
--- a/drivers/serial/serial_ns16550_pci.c
+++ b/drivers/serial/serial_ns16550_pci.c
@@ -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;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] serial: ns16550_pci: fix possible read of uninitialized variable
  2020-02-12  9:38 [PATCH] serial: ns16550_pci: fix possible read of uninitialized variable Ahmad Fatoum
@ 2020-02-14  7:44 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-02-14  7:44 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Wed, Feb 12, 2020 at 10:38:39AM +0100, Ahmad Fatoum wrote:
> 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.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  drivers/serial/serial_ns16550_pci.c | 6 ------
>  1 file changed, 6 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/serial/serial_ns16550_pci.c b/drivers/serial/serial_ns16550_pci.c
> index d4b5bd8898b7..392a2810d815 100644
> --- a/drivers/serial/serial_ns16550_pci.c
> +++ b/drivers/serial/serial_ns16550_pci.c
> @@ -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;
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-14  7:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12  9:38 [PATCH] serial: ns16550_pci: fix possible read of uninitialized variable Ahmad Fatoum
2020-02-14  7:44 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox