diff mbox series

[nft] mnl: Fix -Wimplicit-function-declaration warnings

Message ID 20191121123332.5245-1-mrostecki@opensuse.org
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nft] mnl: Fix -Wimplicit-function-declaration warnings | expand

Commit Message

Michal Rostecki Nov. 21, 2019, 12:33 p.m. UTC
This change fixes the following warnings:

mnl.c: In function ‘mnl_nft_flowtable_add’:
mnl.c:1442:14: warning: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration]
  dev_array = calloc(len, sizeof(char *));
              ^~~~~~
mnl.c:1442:14: warning: incompatible implicit declaration of built-in function ‘calloc’
mnl.c:1442:14: note: include ‘<stdlib.h>’ or provide a declaration of ‘calloc’
mnl.c:1449:2: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
  free(dev_array);
  ^~~~
mnl.c:1449:2: warning: incompatible implicit declaration of built-in function ‘free’
mnl.c:1449:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
---
 src/mnl.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Phil Sutter Nov. 21, 2019, 1:35 p.m. UTC | #1
On Thu, Nov 21, 2019 at 01:33:32PM +0100, Michal Rostecki wrote:
> This change fixes the following warnings:
> 
> mnl.c: In function ‘mnl_nft_flowtable_add’:
> mnl.c:1442:14: warning: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration]
>   dev_array = calloc(len, sizeof(char *));
>               ^~~~~~
> mnl.c:1442:14: warning: incompatible implicit declaration of built-in function ‘calloc’
> mnl.c:1442:14: note: include ‘<stdlib.h>’ or provide a declaration of ‘calloc’
> mnl.c:1449:2: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
>   free(dev_array);
>   ^~~~
> mnl.c:1449:2: warning: incompatible implicit declaration of built-in function ‘free’
> mnl.c:1449:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’
> 
> Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>

Fixes: 1698fca7d49ff ("mnl: remove artifical cap on 8 devices per flowtable")
Acked-by: Phil Sutter <phil@nwl.cc>
Pablo Neira Ayuso Nov. 21, 2019, 1:40 p.m. UTC | #2
On Thu, Nov 21, 2019 at 01:33:32PM +0100, Michal Rostecki wrote:
> This change fixes the following warnings:
> 
> mnl.c: In function ‘mnl_nft_flowtable_add’:
> mnl.c:1442:14: warning: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration]
>   dev_array = calloc(len, sizeof(char *));
>               ^~~~~~
> mnl.c:1442:14: warning: incompatible implicit declaration of built-in function ‘calloc’
> mnl.c:1442:14: note: include ‘<stdlib.h>’ or provide a declaration of ‘calloc’
> mnl.c:1449:2: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
>   free(dev_array);
>   ^~~~
> mnl.c:1449:2: warning: incompatible implicit declaration of built-in function ‘free’
> mnl.c:1449:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’

Applied, thanks.
diff mbox series

Patch

diff --git a/src/mnl.c b/src/mnl.c
index fdba0af8..aa5b0b46 100644
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -30,6 +30,7 @@ 
 #include <arpa/inet.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <stdlib.h>
 #include <utils.h>
 #include <nftables.h>