On 12/08/2024 16:11, Joshua Lant wrote:
On morello architecture, use of kernel pointers in the uapi structures is not permitted, due to different alignment requirements. Modify these to be unsigned longs.
Signed-off-by: Joshua Lant joshualant@gmail.com
include/uapi/linux/netfilter/xt_RATEEST.h | 3 ++- net/netfilter/xt_RATEEST.c | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/uapi/linux/netfilter/xt_RATEEST.h b/include/uapi/linux/netfilter/xt_RATEEST.h index 2b87a71e6266..14a45eba7f4a 100644 --- a/include/uapi/linux/netfilter/xt_RATEEST.h +++ b/include/uapi/linux/netfilter/xt_RATEEST.h @@ -11,7 +11,8 @@ struct xt_rateest_target_info { __u8 ewma_log; /* Used internally by the kernel */
- struct xt_rateest *est __attribute__((aligned(8)));
- /* Corresponds to struct xt_rateest */
- unsigned long est __attribute__((aligned(8)));
}; #endif /* _XT_RATEEST_TARGET_H */ diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c index 80f6624e2355..15e080762db3 100644 --- a/net/netfilter/xt_RATEEST.c +++ b/net/netfilter/xt_RATEEST.c @@ -94,12 +94,12 @@ static unsigned int xt_rateest_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct xt_rateest_target_info *info = par->targinfo;
- struct gnet_stats_basic_sync *stats = &info->est->bstats;
- struct gnet_stats_basic_sync *stats = &((struct xt_rateest *)info->est)->bstats;
- spin_lock_bh(&info->est->lock);
- spin_lock_bh(&((struct xt_rateest *)info->est)->lock); u64_stats_add(&stats->bytes, skb->len); u64_stats_inc(&stats->packets);
- spin_unlock_bh(&info->est->lock);
- spin_unlock_bh(&((struct xt_rateest *)info->est)->lock);
return XT_CONTINUE; } @@ -134,7 +134,7 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par) xt_rateest_put(par->net, est); return -EINVAL; }
info->est = est;
return 0; }info->est = (unsigned long) est;
@@ -160,7 +160,7 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par) if (ret < 0) goto err2;
- info->est = est;
- info->est = (unsigned long) est; xt_rateest_hash_insert(xn, est); mutex_unlock(&xn->hash_lock); return 0;
@@ -176,7 +176,7 @@ static void xt_rateest_tg_destroy(const struct xt_tgdtor_param *par) { struct xt_rateest_target_info *info = par->targinfo;
- xt_rateest_put(par->net, info->est);
- xt_rateest_put(par->net, ((struct xt_rateest *)info->est));
Nit: no need for parentheses around the expression here.
Kevin
} static struct xt_target xt_rateest_tg_reg __read_mostly = {