[PATCH 1/9] route/link: pass proper type to sizeof() for calloc() in vlan_parse()

Thomas Haller thaller at redhat.com
Tue Jun 10 09:59:37 PDT 2014


This fixes the following compiler warning:
  lib/route/link/vlan.c:148:23:warning – Result of 'calloc' is converted to a pointer of type 'struct vlan_map', which is incompatible with sizeof operand type 'struct ifla_vlan_qos_mapping'

This was not a real problem, because the types are effectively
the same.

Signed-off-by: Thomas Haller <thaller at redhat.com>
---
 lib/route/link/vlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/route/link/vlan.c b/lib/route/link/vlan.c
index 1a0d916..b9f0c66 100644
--- a/lib/route/link/vlan.c
+++ b/lib/route/link/vlan.c
@@ -145,7 +145,7 @@ static int vlan_parse(struct rtnl_link *link, struct nlattr *data,
 
 		/* align to have a little reserve */
 		vi->vi_egress_size = (i + 32) & ~31;
-		vi->vi_egress_qos = calloc(vi->vi_egress_size, sizeof(*map));
+		vi->vi_egress_qos = calloc(vi->vi_egress_size, sizeof(*vi->vi_egress_qos));
 		if (vi->vi_egress_qos == NULL)
 			return -NLE_NOMEM;
 
-- 
1.9.3




More information about the libnl mailing list