linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* arch/mips/include/asm/addrspace.h:88:37: warning: passing argument 1 of 'kfree' makes pointer from integer without a cast
@ 2020-10-16 10:04 kernel test robot
  2020-10-16 15:02 ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2020-10-16 10:04 UTC (permalink / raw)
  To: Valentin Vidic; +Cc: kbuild-all, linux-kernel, Jakub Kicinski

[-- Attachment #1: Type: text/plain, Size: 5392 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9ff9b0d392ea08090cd1780fb196f36dbb586529
commit: 3af5f0f5c74ecbaf757ef06c3f80d56751277637 net: korina: fix kfree of rx/tx descriptor array
date:   4 days ago
config: mips-rb532_defconfig (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3af5f0f5c74ecbaf757ef06c3f80d56751277637
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 3af5f0f5c74ecbaf757ef06c3f80d56751277637
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from arch/mips/include/asm/barrier.h:11,
                    from arch/mips/include/asm/bitops.h:19,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from drivers/net/ethernet/korina.c:36:
   drivers/net/ethernet/korina.c: In function 'korina_probe':
>> arch/mips/include/asm/addrspace.h:88:37: warning: passing argument 1 of 'kfree' makes pointer from integer without a cast [-Wint-conversion]
      88 | #define KSEG0ADDR(a)  (CPHYSADDR(a) | KSEG0)
         |                       ~~~~~~~~~~~~~~^~~~~~~~
         |                                     |
         |                                     unsigned int
   drivers/net/ethernet/korina.c:1116:8: note: in expansion of macro 'KSEG0ADDR'
    1116 |  kfree(KSEG0ADDR(lp->td_ring));
         |        ^~~~~~~~~
   In file included from include/linux/irq.h:21,
                    from include/asm-generic/hardirq.h:13,
                    from arch/mips/include/asm/hardirq.h:16,
                    from include/linux/hardirq.h:10,
                    from include/linux/interrupt.h:11,
                    from drivers/net/ethernet/korina.c:42:
   include/linux/slab.h:185:12: note: expected 'const void *' but argument is of type 'unsigned int'
     185 | void kfree(const void *);
         |            ^~~~~~~~~~~~
   In file included from arch/mips/include/asm/barrier.h:11,
                    from arch/mips/include/asm/bitops.h:19,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from drivers/net/ethernet/korina.c:36:
   drivers/net/ethernet/korina.c: In function 'korina_remove':
>> arch/mips/include/asm/addrspace.h:88:37: warning: passing argument 1 of 'kfree' makes pointer from integer without a cast [-Wint-conversion]
      88 | #define KSEG0ADDR(a)  (CPHYSADDR(a) | KSEG0)
         |                       ~~~~~~~~~~~~~~^~~~~~~~
         |                                     |
         |                                     unsigned int
   drivers/net/ethernet/korina.c:1136:8: note: in expansion of macro 'KSEG0ADDR'
    1136 |  kfree(KSEG0ADDR(lp->td_ring));
         |        ^~~~~~~~~
   In file included from include/linux/irq.h:21,
                    from include/asm-generic/hardirq.h:13,
                    from arch/mips/include/asm/hardirq.h:16,
                    from include/linux/hardirq.h:10,
                    from include/linux/interrupt.h:11,
                    from drivers/net/ethernet/korina.c:42:
   include/linux/slab.h:185:12: note: expected 'const void *' but argument is of type 'unsigned int'
     185 | void kfree(const void *);
         |            ^~~~~~~~~~~~

vim +/kfree +88 arch/mips/include/asm/addrspace.h

^1da177e4c3f415 include/asm-mips/addrspace.h Linus Torvalds 2005-04-16  84  
^1da177e4c3f415 include/asm-mips/addrspace.h Linus Torvalds 2005-04-16  85  /*
^1da177e4c3f415 include/asm-mips/addrspace.h Linus Torvalds 2005-04-16  86   * Map an address to a certain kernel segment
^1da177e4c3f415 include/asm-mips/addrspace.h Linus Torvalds 2005-04-16  87   */
^1da177e4c3f415 include/asm-mips/addrspace.h Linus Torvalds 2005-04-16 @88  #define KSEG0ADDR(a)		(CPHYSADDR(a) | KSEG0)
^1da177e4c3f415 include/asm-mips/addrspace.h Linus Torvalds 2005-04-16  89  #define KSEG1ADDR(a)		(CPHYSADDR(a) | KSEG1)
^1da177e4c3f415 include/asm-mips/addrspace.h Linus Torvalds 2005-04-16  90  #define KSEG2ADDR(a)		(CPHYSADDR(a) | KSEG2)
^1da177e4c3f415 include/asm-mips/addrspace.h Linus Torvalds 2005-04-16  91  #define KSEG3ADDR(a)		(CPHYSADDR(a) | KSEG3)
^1da177e4c3f415 include/asm-mips/addrspace.h Linus Torvalds 2005-04-16  92  

:::::: The code at line 88 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 16026 bytes --]

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

* Re: arch/mips/include/asm/addrspace.h:88:37: warning: passing argument 1 of 'kfree' makes pointer from integer without a cast
  2020-10-16 10:04 arch/mips/include/asm/addrspace.h:88:37: warning: passing argument 1 of 'kfree' makes pointer from integer without a cast kernel test robot
@ 2020-10-16 15:02 ` Jakub Kicinski
  2020-10-16 19:46   ` Valentin Vidić
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2020-10-16 15:02 UTC (permalink / raw)
  To: kernel test robot; +Cc: Valentin Vidic, kbuild-all, linux-kernel

On Fri, 16 Oct 2020 18:04:29 +0800 kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   9ff9b0d392ea08090cd1780fb196f36dbb586529
> commit: 3af5f0f5c74ecbaf757ef06c3f80d56751277637 net: korina: fix kfree of rx/tx descriptor array
> date:   4 days ago
> config: mips-rb532_defconfig (attached as .config)
> compiler: mipsel-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3af5f0f5c74ecbaf757ef06c3f80d56751277637
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 3af5f0f5c74ecbaf757ef06c3f80d56751277637
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from arch/mips/include/asm/barrier.h:11,
>                     from arch/mips/include/asm/bitops.h:19,
>                     from include/linux/bitops.h:29,
>                     from include/linux/kernel.h:12,
>                     from include/linux/list.h:9,
>                     from include/linux/module.h:12,
>                     from drivers/net/ethernet/korina.c:36:
>    drivers/net/ethernet/korina.c: In function 'korina_probe':
> >> arch/mips/include/asm/addrspace.h:88:37: warning: passing argument 1 of 'kfree' makes pointer from integer without a cast [-Wint-conversion]  
>       88 | #define KSEG0ADDR(a)  (CPHYSADDR(a) | KSEG0)
>          |                       ~~~~~~~~~~~~~~^~~~~~~~
>          |                                     |
>          |                                     unsigned int
>    drivers/net/ethernet/korina.c:1116:8: note: in expansion of macro 'KSEG0ADDR'
>     1116 |  kfree(KSEG0ADDR(lp->td_ring));
>          |        ^~~~~~~~~

Valentin, looks like we're missing a cast to (void *) or some other
pointer.. Would you mind sending a fix? You can find cross compilers 
to test it here, cause this probably only builds for MIPS:

https://mirrors.edge.kernel.org/pub/tools/crosstool/


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

* Re: arch/mips/include/asm/addrspace.h:88:37: warning: passing argument 1 of 'kfree' makes pointer from integer without a cast
  2020-10-16 15:02 ` Jakub Kicinski
@ 2020-10-16 19:46   ` Valentin Vidić
  2020-10-18 18:42     ` [PATCH] net: korina: cast KSEG0 address to pointer in kfree Valentin Vidic
  0 siblings, 1 reply; 5+ messages in thread
From: Valentin Vidić @ 2020-10-16 19:46 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: kernel test robot, kbuild-all, linux-kernel

On Fri, Oct 16, 2020 at 08:02:51AM -0700, Jakub Kicinski wrote:
> Valentin, looks like we're missing a cast to (void *) or some other
> pointer.. Would you mind sending a fix? You can find cross compilers 
> to test it here, cause this probably only builds for MIPS:
> 
> https://mirrors.edge.kernel.org/pub/tools/crosstool/

Ahh sorry about this, will try to setup cross compiler over the weekend
and check the warning.

-- 
Valentin

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

* [PATCH] net: korina: cast KSEG0 address to pointer in kfree
  2020-10-16 19:46   ` Valentin Vidić
@ 2020-10-18 18:42     ` Valentin Vidic
  2020-10-20  0:04       ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Valentin Vidic @ 2020-10-18 18:42 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: David S. Miller, Philip Rischel, Florian Fainelli,
	Roman Yeryomin, Willem de Bruijn, Andrew Morton, Mike Rapoport,
	Martin Habets, Michael S. Tsirkin, Network Development,
	linux-kernel, Valentin Vidic, kernel test robot

Fixes gcc warning:

passing argument 1 of 'kfree' makes pointer from integer without a cast

Fixes: 3af5f0f5c74e ("net: korina: fix kfree of rx/tx descriptor array")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>
---
 drivers/net/ethernet/korina.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index af441d699a57..bf48f0ded9c7 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -1113,7 +1113,7 @@ static int korina_probe(struct platform_device *pdev)
 	return rc;
 
 probe_err_register:
-	kfree(KSEG0ADDR(lp->td_ring));
+	kfree((struct dma_desc *)KSEG0ADDR(lp->td_ring));
 probe_err_td_ring:
 	iounmap(lp->tx_dma_regs);
 probe_err_dma_tx:
@@ -1133,7 +1133,7 @@ static int korina_remove(struct platform_device *pdev)
 	iounmap(lp->eth_regs);
 	iounmap(lp->rx_dma_regs);
 	iounmap(lp->tx_dma_regs);
-	kfree(KSEG0ADDR(lp->td_ring));
+	kfree((struct dma_desc *)KSEG0ADDR(lp->td_ring));
 
 	unregister_netdev(bif->dev);
 	free_netdev(bif->dev);
-- 
2.20.1


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

* Re: [PATCH] net: korina: cast KSEG0 address to pointer in kfree
  2020-10-18 18:42     ` [PATCH] net: korina: cast KSEG0 address to pointer in kfree Valentin Vidic
@ 2020-10-20  0:04       ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2020-10-20  0:04 UTC (permalink / raw)
  To: Valentin Vidic
  Cc: David S. Miller, Philip Rischel, Florian Fainelli,
	Roman Yeryomin, Willem de Bruijn, Andrew Morton, Mike Rapoport,
	Martin Habets, Michael S. Tsirkin, Network Development,
	linux-kernel, kernel test robot

On Sun, 18 Oct 2020 20:42:55 +0200 Valentin Vidic wrote:
> Fixes gcc warning:
> 
> passing argument 1 of 'kfree' makes pointer from integer without a cast
> 
> Fixes: 3af5f0f5c74e ("net: korina: fix kfree of rx/tx descriptor array")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>

Applied, thank you!

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

end of thread, other threads:[~2020-10-20  0:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 10:04 arch/mips/include/asm/addrspace.h:88:37: warning: passing argument 1 of 'kfree' makes pointer from integer without a cast kernel test robot
2020-10-16 15:02 ` Jakub Kicinski
2020-10-16 19:46   ` Valentin Vidić
2020-10-18 18:42     ` [PATCH] net: korina: cast KSEG0 address to pointer in kfree Valentin Vidic
2020-10-20  0:04       ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).