2021-11-25 07:07:45

by Dan Carpenter

[permalink] [raw]
Subject: net/mctp/test/utils.c:15 mctp_test_dev_tx() error: use kfree_skb() here instead of kfree(skb)

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5f53fa508db098c9d372423a6dac31c8a5679cdf
commit: ded21b72299529cc143a4213ea0ec4b0c620b8eb mctp: Add test utils
config: x86_64-randconfig-m001-20211122 (https://download.01.org/0day-ci/archive/20211125/[email protected]/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
net/mctp/test/utils.c:15 mctp_test_dev_tx() error: use kfree_skb() here instead of kfree(skb)

vim +15 net/mctp/test/utils.c

ded21b72299529c Jeremy Kerr 2021-10-03 12 static netdev_tx_t mctp_test_dev_tx(struct sk_buff *skb,
ded21b72299529c Jeremy Kerr 2021-10-03 13 struct net_device *ndev)
ded21b72299529c Jeremy Kerr 2021-10-03 14 {
ded21b72299529c Jeremy Kerr 2021-10-03 @15 kfree(skb);

This should be kfree_skb(skb);

ded21b72299529c Jeremy Kerr 2021-10-03 16 return NETDEV_TX_OK;
ded21b72299529c Jeremy Kerr 2021-10-03 17 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]



2021-11-29 02:26:22

by Jeremy Kerr

[permalink] [raw]
Subject: Re: net/mctp/test/utils.c:15 mctp_test_dev_tx() error: use kfree_skb() here instead of kfree(skb)

Hi Dan,

> smatch warnings:
> net/mctp/test/utils.c:15 mctp_test_dev_tx() error: use kfree_skb() here instead of kfree(skb)

Thanks for the report! I've sent a fix, you're CCed.

However, I can 't seem to recreate the smatch warning; could you include
the build command you're using for these? I've tried with

make [...] C=1 CHECK=/path/to/smatch

using smatch 4f2585888, but that doesn't report the error you've listed
there. Do I need any specific CHECKFLAGS?

Cheers,


Jeremy


2021-11-29 07:55:44

by Dan Carpenter

[permalink] [raw]
Subject: Re: net/mctp/test/utils.c:15 mctp_test_dev_tx() error: use kfree_skb() here instead of kfree(skb)

On Mon, Nov 29, 2021 at 10:24:15AM +0800, Jeremy Kerr wrote:
> Hi Dan,
>
> > smatch warnings:
> > net/mctp/test/utils.c:15 mctp_test_dev_tx() error: use kfree_skb() here instead of kfree(skb)
>
> Thanks for the report! I've sent a fix, you're CCed.
>
> However, I can 't seem to recreate the smatch warning; could you include
> the build command you're using for these? I've tried with
>
> make [...] C=1 CHECK=/path/to/smatch

The CHECK= string needs a -p=kernel added to it or it won't do kernel
specific checking.

make [...] C=1 CHECK="/path/to/smatch -p=kernel"

regards,
dan carpenter