From fa7f70f8042c5fd8b64821cbfd66fdea5c1a2a67 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Wed, 26 Jan 2011 22:26:01 +0100 Subject: Correct the error codes: use ENOENT and EMSGSIZE Use correct error codes (Patrick McHardy's review) --- kernel/ip_set_list_set.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'kernel/ip_set_list_set.c') diff --git a/kernel/ip_set_list_set.c b/kernel/ip_set_list_set.c index 892a106..933d9ef 100644 --- a/kernel/ip_set_list_set.c +++ b/kernel/ip_set_list_set.c @@ -392,7 +392,7 @@ list_set_head(struct ip_set *set, struct sk_buff *skb) return 0; nla_put_failure: - return -EFAULT; + return -EMSGSIZE; } static int @@ -406,7 +406,7 @@ list_set_list(const struct ip_set *set, atd = ipset_nest_start(skb, IPSET_ATTR_ADT); if (!atd) - return -EFAULT; + return -EMSGSIZE; for (; cb->args[2] < map->size; cb->args[2]++) { i = cb->args[2]; e = list_set_elem(map, i); @@ -418,7 +418,7 @@ list_set_list(const struct ip_set *set, if (!nested) { if (i == first) { nla_nest_cancel(skb, atd); - return -EFAULT; + return -EMSGSIZE; } else goto nla_put_failure; } @@ -441,6 +441,10 @@ finish: nla_put_failure: nla_nest_cancel(skb, nested); ipset_nest_end(skb, atd); + if (unlikely(i == first)) { + cb->args[2] = 0; + return -EMSGSIZE; + } return 0; } -- cgit v1.2.3