unsigned int entry_offset;
        int off, i, ret;
 
-       off = 0;
+       off = sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
        entry_offset = (void *)e - base;
        IPT_MATCH_ITERATE(e, compat_calc_match, &off);
        t = ipt_get_target(e);
                goto out;
 
        *dstptr += sizeof(struct compat_ipt_entry);
+       *size -= sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
+
        ret = IPT_MATCH_ITERATE(e, xt_compat_match_to_user, dstptr, size);
        target_offset = e->target_offset - (origsize - *size);
        if (ret)
        if (ret)
                return ret;
 
-       off = 0;
+       off = sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
        entry_offset = (void *)e - (void *)base;
        j = 0;
        ret = IPT_MATCH_ITERATE(e, compat_find_calc_match, name, &e->ip,
        memcpy(de, e, sizeof(struct ipt_entry));
 
        *dstptr += sizeof(struct compat_ipt_entry);
+       *size += sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
+
        ret = IPT_MATCH_ITERATE(e, xt_compat_match_from_user, dstptr, size);
        if (ret)
                return ret;