summaryrefslogtreecommitdiffstats
path: root/net/caif/chnl_net.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-04-01 20:48:13 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-02 04:33:44 -0400
commit2809cec5b52b2d02fa0d7dab6e146abfc93c5b86 (patch)
tree2ece27cce40a138aaad94de47b354db5c1e562f3 /net/caif/chnl_net.c
parent14ad6647f3c919b4ee987e2058fbc6c10f29bb53 (diff)
downloadlinux-2809cec5b52b2d02fa0d7dab6e146abfc93c5b86.tar.gz
linux-2809cec5b52b2d02fa0d7dab6e146abfc93c5b86.tar.bz2
linux-2809cec5b52b2d02fa0d7dab6e146abfc93c5b86.zip
caif: Stop using NLA_PUT*().
These macros contain a hidden goto, and are thus extremely error prone and make code hard to audit. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif/chnl_net.c')
-rw-r--r--net/caif/chnl_net.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c
index 20618dd3088b..93e9c6dc9ddf 100644
--- a/net/caif/chnl_net.c
+++ b/net/caif/chnl_net.c
@@ -421,14 +421,14 @@ static int ipcaif_fill_info(struct sk_buff *skb, const struct net_device *dev)
struct chnl_net *priv;
u8 loop;
priv = netdev_priv(dev);
- NLA_PUT_U32(skb, IFLA_CAIF_IPV4_CONNID,
- priv->conn_req.sockaddr.u.dgm.connection_id);
- NLA_PUT_U32(skb, IFLA_CAIF_IPV6_CONNID,
- priv->conn_req.sockaddr.u.dgm.connection_id);
+ if (nla_put_u32(skb, IFLA_CAIF_IPV4_CONNID,
+ priv->conn_req.sockaddr.u.dgm.connection_id) ||
+ nla_put_u32(skb, IFLA_CAIF_IPV6_CONNID,
+ priv->conn_req.sockaddr.u.dgm.connection_id))
+ goto nla_put_failure;
loop = priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP;
- NLA_PUT_U8(skb, IFLA_CAIF_LOOPBACK, loop);
-
-
+ if (nla_put_u8(skb, IFLA_CAIF_LOOPBACK, loop))
+ goto nla_put_failure;
return 0;
nla_put_failure:
return -EMSGSIZE;