math: fix an out of memory issue
[smatch.git] / validation / sm_netdevice.c
blob34cf1375a3c99a49d3f507a136d15b85b6854078
2 void kfree(void *);
4 struct net_device {
5 char *name;
6 };
8 void func(void)
10 struct net_device dev;
11 struct net_device *dev2 = &dev;
12 struct net_device **dev3 = &dev2;
13 struct net_device *deva[10];
14 struct net_device **devb[10];
15 struct net_device ***devc = devb;
17 kfree(dev2);
18 kfree(dev3);
19 kfree(deva[0]);
20 kfree(devb[0]);
21 kfree(devc[0]);
24 * check-name: free_netdev() vs kfree()
25 * check-command: smatch -p=kernel sm_netdevice.c
27 * check-output-start
28 sm_netdevice.c:17 func() error: use free_netdev() here instead of kfree(dev2)
29 sm_netdevice.c:19 func() error: use free_netdev() here instead of kfree(deva[0])
30 * check-output-end