]> nv-tegra.nvidia Code Review - linux-2.6.git/commit
netlink: invert error code in netlink_set_err()
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 4 Mar 2009 07:37:30 +0000 (23:37 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Mar 2009 07:37:30 +0000 (23:37 -0800)
commit4843b93c96ae5043c6279c4ec6fcd8ee3866ff5b
tree58532635d403fba5b1514dfbf2c707f93b5ba1ed
parent17edde520927070a6bf14a6a75027c0b843443e5
netlink: invert error code in netlink_set_err()

The callers of netlink_set_err() currently pass a negative value
as parameter for the error code. However, sk->sk_err wants a
positive error value. Without this patch, skb_recv_datagram() called
by netlink_recvmsg() may return a positive value to report an error.

Another choice to fix this is to change callers to pass a positive
error value, but this seems a bit inconsistent and error prone
to me. Indeed, the callers of netlink_set_err() assumed that the
(usual) negative value for error codes was fine before this patch :).

This patch also includes some documentation in docbook format
for netlink_set_err() to avoid this sort of confusion.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/af_netlink.c