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-next>] [day] [month] [year] [list]
Message-ID: <20201116092505.GU29398@kadam>
Date:   Mon, 16 Nov 2020 12:25:06 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:     lkp@...el.com, Dan Carpenter <error27@...il.com>,
        kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Li Yang <leoyang.li@....com>, Timur Tabi <timur@...nel.org>
Subject: drivers/net/ethernet/freescale/gianfar.c:580 gfar_parse_group()
 warn: 'grp->regs' not released on lines: 517.

Hi Rasmus,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1
commit: 5a35435ef4e6e4bd2aabd6706b146b298a9cffe5 soc: fsl: qe: remove PPC32 dependency from CONFIG_QUICC_ENGINE
config: powerpc64-randconfig-m031-20201113 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/net/ethernet/freescale/gianfar.c:580 gfar_parse_group() warn: 'grp->regs' not released on lines: 517.

vim +580 drivers/net/ethernet/freescale/gianfar.c

46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  491  static int gfar_parse_group(struct device_node *np,
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  492  			    struct gfar_private *priv, const char *model)
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  493  {
5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  494  	struct gfar_priv_grp *grp = &priv->gfargrp[priv->num_grps];
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  495  	int i;
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  496  
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  497  	for (i = 0; i < GFAR_NUM_IRQS; i++) {
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  498  		grp->irqinfo[i] = kzalloc(sizeof(struct gfar_irqinfo),
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  499  					  GFP_KERNEL);
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  500  		if (!grp->irqinfo[i])
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  501  			return -ENOMEM;
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  502  	}
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  503  
5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  504  	grp->regs = of_iomap(np, 0);
                                                                                                            ^^^^^^^^^^^^^^^

5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  505  	if (!grp->regs)
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  506  		return -ENOMEM;
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  507  
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  508  	gfar_irq(grp, TX)->irq = irq_of_parse_and_map(np, 0);
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  509  
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  510  	/* If we aren't the FEC we have multiple interrupts */
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  511  	if (model && strcasecmp(model, "FEC")) {
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  512  		gfar_irq(grp, RX)->irq = irq_of_parse_and_map(np, 1);
ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  513  		gfar_irq(grp, ER)->irq = irq_of_parse_and_map(np, 2);
fea0f6650979a4f drivers/net/ethernet/freescale/gianfar.c Mark Brown       2015-11-26  514  		if (!gfar_irq(grp, TX)->irq ||
fea0f6650979a4f drivers/net/ethernet/freescale/gianfar.c Mark Brown       2015-11-26  515  		    !gfar_irq(grp, RX)->irq ||
fea0f6650979a4f drivers/net/ethernet/freescale/gianfar.c Mark Brown       2015-11-26  516  		    !gfar_irq(grp, ER)->irq)
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  517  			return -EINVAL;

This should unmap "grp->regs".

46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  518  	}
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  519  
5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  520  	grp->priv = priv;
5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  521  	spin_lock_init(&grp->grplock);
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  522  	if (priv->mode == MQ_MG_MODE) {
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  523  		u32 rxq_mask, txq_mask;
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  524  		int ret;
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  525  
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  526  		grp->rx_bit_map = (DEFAULT_MAPPING >> priv->num_grps);
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  527  		grp->tx_bit_map = (DEFAULT_MAPPING >> priv->num_grps);
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  528  
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  529  		ret = of_property_read_u32(np, "fsl,rx-bit-map", &rxq_mask);
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  530  		if (!ret) {
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  531  			grp->rx_bit_map = rxq_mask ?
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  532  			rxq_mask : (DEFAULT_MAPPING >> priv->num_grps);
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  533  		}
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  534  
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  535  		ret = of_property_read_u32(np, "fsl,tx-bit-map", &txq_mask);
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  536  		if (!ret) {
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  537  			grp->tx_bit_map = txq_mask ?
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  538  			txq_mask : (DEFAULT_MAPPING >> priv->num_grps);
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  539  		}
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  540  
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  541  		if (priv->poll_mode == GFAR_SQ_POLLING) {
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  542  			/* One Q per interrupt group: Q0 to G0, Q1 to G1 */
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  543  			grp->rx_bit_map = (DEFAULT_MAPPING >> priv->num_grps);
559176415cc663f drivers/net/ethernet/freescale/gianfar.c Jingchang Lu     2015-03-13  544  			grp->tx_bit_map = (DEFAULT_MAPPING >> priv->num_grps);
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  545  		}
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  546  	} else {
5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  547  		grp->rx_bit_map = 0xFF;
5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2013-01-29  548  		grp->tx_bit_map = 0xFF;
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  549  	}
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  550  
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  551  	/* bit_map's MSB is q0 (from q0 to q7) but, for_each_set_bit parses
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  552  	 * right to left, so we need to revert the 8 bits to get the q index
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  553  	 */
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  554  	grp->rx_bit_map = bitrev8(grp->rx_bit_map);
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  555  	grp->tx_bit_map = bitrev8(grp->tx_bit_map);
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  556  
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  557  	/* Calculate RSTAT, TSTAT, RQUEUE and TQUEUE values,
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  558  	 * also assign queues to groups
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  559  	 */
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  560  	for_each_set_bit(i, &grp->rx_bit_map, priv->num_rx_queues) {
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  561  		if (!grp->rx_queue)
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  562  			grp->rx_queue = priv->rx_queue[i];
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  563  		grp->num_rx_queues++;
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  564  		grp->rstat |= (RSTAT_CLEAR_RHALT >> i);
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  565  		priv->rqueue |= ((RQUEUE_EN0 | RQUEUE_EX0) >> i);
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  566  		priv->rx_queue[i]->grp = grp;
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  567  	}
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  568  
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  569  	for_each_set_bit(i, &grp->tx_bit_map, priv->num_tx_queues) {
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  570  		if (!grp->tx_queue)
71ff9e3df7e1c5d drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-03-07  571  			grp->tx_queue = priv->tx_queue[i];
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  572  		grp->num_tx_queues++;
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  573  		grp->tstat |= (TSTAT_CLEAR_THALT >> i);
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  574  		priv->tqueue |= (TQUEUE_EN0 >> i);
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  575  		priv->tx_queue[i]->grp = grp;
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  576  	}
208627883ecfaa1 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil   2014-02-17  577  
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  578  	priv->num_grps++;
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  579  
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02 @580  	return 0;
46ceb60ca80fa07 drivers/net/gianfar.c                    Sandeep Gopalpet 2009-11-02  581  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (34540 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ