Commit be4bae19 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] netfilter: Remove copy_to_user Warnings in Netfilter

After changing firewall rules, we try to return the counters to userspace.  We
didn't fail at that point if the copy failed, but it doesn't really matter.
Someone added a warn_unused_result attribute to copy_to_user, so we get bogus
warnings.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f631723a
......@@ -948,12 +948,12 @@ static int do_replace(void __user *user, unsigned int len)
/* Decrease module usage counts and free resource */
ARPT_ENTRY_ITERATE(oldinfo->entries, oldinfo->size, cleanup_entry,NULL);
vfree(oldinfo);
/* Silent error: too late now. */
copy_to_user(tmp.counters, counters,
sizeof(struct arpt_counters) * tmp.num_counters);
if (copy_to_user(tmp.counters, counters,
sizeof(struct arpt_counters) * tmp.num_counters) != 0)
ret = -EFAULT;
vfree(counters);
up(&arpt_mutex);
return 0;
return ret;
put_module:
module_put(t->me);
......
......@@ -1141,12 +1141,12 @@ do_replace(void __user *user, unsigned int len)
/* Decrease module usage counts and free resource */
IPT_ENTRY_ITERATE(oldinfo->entries, oldinfo->size, cleanup_entry,NULL);
vfree(oldinfo);
/* Silent error: too late now. */
copy_to_user(tmp.counters, counters,
sizeof(struct ipt_counters) * tmp.num_counters);
if (copy_to_user(tmp.counters, counters,
sizeof(struct ipt_counters) * tmp.num_counters) != 0)
ret = -EFAULT;
vfree(counters);
up(&ipt_mutex);
return 0;
return ret;
put_module:
module_put(t->me);
......
......@@ -1222,11 +1222,12 @@ do_replace(void __user *user, unsigned int len)
IP6T_ENTRY_ITERATE(oldinfo->entries, oldinfo->size, cleanup_entry,NULL);
vfree(oldinfo);
/* Silent error: too late now. */
copy_to_user(tmp.counters, counters,
sizeof(struct ip6t_counters) * tmp.num_counters);
if (copy_to_user(tmp.counters, counters,
sizeof(struct ip6t_counters) * tmp.num_counters) != 0)
ret = -EFAULT;
vfree(counters);
up(&ip6t_mutex);
return 0;
return ret;
put_module:
module_put(t->me);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment