[lvc-project] [PATCH] net-wan: Add check for NULL for utdm in ucc_hdlc_probe

Екатерина Есина eesina at astralinux.ru
Tue Jan 10 10:21:16 MSK 2023


  
  
   
   

-----Original Message-----

From: Christophe <christophe.leroy at csgroup.eu>
To: Ekaterina <eesina at astralinux.ru>; Zhao <qiang.zhao at nxp.com>
Cc: lvc-project <lvc-project at linuxtesting.org>; netdev <netdev at vger.kernel.org>; linux-kernel <linux-kernel at vger.kernel.org>; Eric <edumazet at google.com>; Jakub <kuba at kernel.org>; Paolo <pabeni at redhat.com>; linuxppc-dev <linuxppc-dev at lists.ozlabs.org>; David <davem at davemloft.net>
Date: Monday, 9 January 2023 6:49 PM MSK
Subject: Re: [PATCH] net-wan: Add check for NULL for utdm in ucc_hdlc_probe



Le 23/12/2022 à 15:32, Ekaterina Esina a écrit : 
> [Vous ne recevez pas souvent de courriers de eesina at astralinux.ru. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] 
> 
> If uhdlc_priv_tsa != 1 then utdm is not initialized. 
> And if ret != NULL then goto undo_uhdlc_init, where utdm is dereferenced. 
> Same if dev == NULL. 
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE. 
> 
> Signed-off-by: Ekaterina Esina <eesina at astralinux.ru> 
> --- 
> drivers/net/wan/fsl_ucc_hdlc.c | 4 +++- 
> 1 file changed, 3 insertions(+), 1 deletion(-) 
> 
> diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c 
> index 22edea6ca4b8..2ddb0f71e648 100644 
> --- a/drivers/net/wan/fsl_ucc_hdlc.c 
> +++ b/drivers/net/wan/fsl_ucc_hdlc.c 
> @@ -1243,7 +1243,9 @@ static int ucc_hdlc_probe(struct platform_device *pdev) 
> free_dev: 
> free_netdev(dev); 
> undo_uhdlc_init: 
> - iounmap(utdm->siram); 
> + if (utdm != NULL) { 
> + iounmap(utdm->siram); 
> + } 

If utdm being NULL is a problem here, isn't it also a problem in the 
iounmap below ? 


> unmap_si_regs: 
> iounmap(utdm->si_regs); 
> free_utdm: 
> -- 
> 2.30.2 
> Yes, below the check is also needed. I guess I should send a new patch with both checks Best wishes, Ekaterina Esina    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://linuxtesting.org/pipermail/lvc-project/attachments/20230110/81f25533/attachment.html>


More information about the lvc-project mailing list