Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89566951 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

[NETFILTER]: x_tables: make xt_compat_match_from_user usable in iterator macros



Make xt_compat_match_from_user return an int to make it usable in the
*tables iterator macros and kill a now unnecessary wrapper function.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4b478248
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -382,7 +382,7 @@ extern void xt_compat_lock(int af);
extern void xt_compat_unlock(int af);
extern void xt_compat_unlock(int af);


extern int xt_compat_match_offset(struct xt_match *match);
extern int xt_compat_match_offset(struct xt_match *match);
extern void xt_compat_match_from_user(struct xt_entry_match *m,
extern int xt_compat_match_from_user(struct xt_entry_match *m,
				     void **dstptr, int *size);
				     void **dstptr, int *size);
extern int xt_compat_match_to_user(struct xt_entry_match *m,
extern int xt_compat_match_to_user(struct xt_entry_match *m,
				   void __user **dstptr, int *size);
				   void __user **dstptr, int *size);
+1 −12
Original line number Original line Diff line number Diff line
@@ -1654,16 +1654,6 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e,
	return ret;
	return ret;
}
}


static inline int
compat_copy_match_from_user(struct ipt_entry_match *m,
			    void **dstptr, compat_uint_t *size,
			    const char *name, const struct ipt_ip *ip,
			    unsigned int hookmask)
{
	xt_compat_match_from_user(m, dstptr, size);
	return 0;
}

static int
static int
compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
			    unsigned int *size, const char *name,
			    unsigned int *size, const char *name,
@@ -1681,8 +1671,7 @@ compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
	memcpy(de, e, sizeof(struct ipt_entry));
	memcpy(de, e, sizeof(struct ipt_entry));


	*dstptr += sizeof(struct compat_ipt_entry);
	*dstptr += sizeof(struct compat_ipt_entry);
	ret = IPT_MATCH_ITERATE(e, compat_copy_match_from_user, dstptr, size,
	ret = IPT_MATCH_ITERATE(e, xt_compat_match_from_user, dstptr, size);
				name, &de->ip, de->comefrom);
	if (ret)
	if (ret)
		return ret;
		return ret;
	de->target_offset = e->target_offset - (origsize - *size);
	de->target_offset = e->target_offset - (origsize - *size);
+3 −2
Original line number Original line Diff line number Diff line
@@ -342,7 +342,7 @@ int xt_compat_match_offset(struct xt_match *match)
}
}
EXPORT_SYMBOL_GPL(xt_compat_match_offset);
EXPORT_SYMBOL_GPL(xt_compat_match_offset);


void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
			      int *size)
			      int *size)
{
{
	struct xt_match *match = m->u.kernel.match;
	struct xt_match *match = m->u.kernel.match;
@@ -365,6 +365,7 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,


	*size += off;
	*size += off;
	*dstptr += msize;
	*dstptr += msize;
	return 0;
}
}
EXPORT_SYMBOL_GPL(xt_compat_match_from_user);
EXPORT_SYMBOL_GPL(xt_compat_match_from_user);