* [PATCH] net: sched: Fix restricted __be16 degrades to integer
@ 2023-11-17 10:18 Kunwu Chan
2023-11-17 12:06 ` Pedro Tammela
0 siblings, 1 reply; 3+ messages in thread
From: Kunwu Chan @ 2023-11-17 10:18 UTC (permalink / raw)
To: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni
Cc: kunwu.chan, netdev, linux-kernel, Kunwu Chan
net/sched/cls_api.c:2010:25: warning: restricted __be16 degrades to integer
net/sched/cls_api.c:2695:50: warning: restricted __be16 degrades to integer
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
net/sched/cls_api.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index f73f39f61f66..4c47490eb0c1 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -2007,7 +2007,7 @@ static int tcf_fill_node(struct net *net, struct sk_buff *skb,
tcm->tcm_ifindex = TCM_IFINDEX_MAGIC_BLOCK;
tcm->tcm_block_index = block->index;
}
- tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol);
+ tcm->tcm_info = TC_H_MAKE(tp->prio, be16_to_cpu(tp->protocol));
if (nla_put_string(skb, TCA_KIND, tp->ops->kind))
goto nla_put_failure;
if (nla_put_u32(skb, TCA_CHAIN, tp->chain->index))
@@ -2692,7 +2692,7 @@ static bool tcf_chain_dump(struct tcf_chain *chain, struct Qdisc *q, u32 parent,
TC_H_MAJ(tcm->tcm_info) != tp->prio)
continue;
if (TC_H_MIN(tcm->tcm_info) &&
- TC_H_MIN(tcm->tcm_info) != tp->protocol)
+ TC_H_MIN(tcm->tcm_info) != be16_to_cpu(tp->protocol))
continue;
if (*p_index > index_start)
memset(&cb->args[1], 0,
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: sched: Fix restricted __be16 degrades to integer
2023-11-17 10:18 [PATCH] net: sched: Fix restricted __be16 degrades to integer Kunwu Chan
@ 2023-11-17 12:06 ` Pedro Tammela
2023-11-20 10:07 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Pedro Tammela @ 2023-11-17 12:06 UTC (permalink / raw)
To: Kunwu Chan, jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni
Cc: kunwu.chan, netdev, linux-kernel
On 17/11/2023 07:18, Kunwu Chan wrote:
> net/sched/cls_api.c:2010:25: warning: restricted __be16 degrades to integer
> net/sched/cls_api.c:2695:50: warning: restricted __be16 degrades to integer
>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> ---
> net/sched/cls_api.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
> index f73f39f61f66..4c47490eb0c1 100644
> --- a/net/sched/cls_api.c
> +++ b/net/sched/cls_api.c
> @@ -2007,7 +2007,7 @@ static int tcf_fill_node(struct net *net, struct sk_buff *skb,
> tcm->tcm_ifindex = TCM_IFINDEX_MAGIC_BLOCK;
> tcm->tcm_block_index = block->index;
> }
> - tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol);
> + tcm->tcm_info = TC_H_MAKE(tp->prio, be16_to_cpu(tp->protocol));
> if (nla_put_string(skb, TCA_KIND, tp->ops->kind))
> goto nla_put_failure;
> if (nla_put_u32(skb, TCA_CHAIN, tp->chain->index))
> @@ -2692,7 +2692,7 @@ static bool tcf_chain_dump(struct tcf_chain *chain, struct Qdisc *q, u32 parent,
> TC_H_MAJ(tcm->tcm_info) != tp->prio)
> continue;
> if (TC_H_MIN(tcm->tcm_info) &&
> - TC_H_MIN(tcm->tcm_info) != tp->protocol)
> + TC_H_MIN(tcm->tcm_info) != be16_to_cpu(tp->protocol))
> continue;
> if (*p_index > index_start)
> memset(&cb->args[1], 0,
I don't believe there's something to fix here
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: sched: Fix restricted __be16 degrades to integer
2023-11-17 12:06 ` Pedro Tammela
@ 2023-11-20 10:07 ` Simon Horman
0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-11-20 10:07 UTC (permalink / raw)
To: Pedro Tammela
Cc: Kunwu Chan, jhs, xiyou.wangcong, jiri, davem, edumazet, kuba,
pabeni, kunwu.chan, netdev, linux-kernel
On Fri, Nov 17, 2023 at 09:06:11AM -0300, Pedro Tammela wrote:
> On 17/11/2023 07:18, Kunwu Chan wrote:
> > net/sched/cls_api.c:2010:25: warning: restricted __be16 degrades to integer
> > net/sched/cls_api.c:2695:50: warning: restricted __be16 degrades to integer
> >
> > Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> > ---
> > net/sched/cls_api.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
> > index f73f39f61f66..4c47490eb0c1 100644
> > --- a/net/sched/cls_api.c
> > +++ b/net/sched/cls_api.c
> > @@ -2007,7 +2007,7 @@ static int tcf_fill_node(struct net *net, struct sk_buff *skb,
> > tcm->tcm_ifindex = TCM_IFINDEX_MAGIC_BLOCK;
> > tcm->tcm_block_index = block->index;
> > }
> > - tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol);
> > + tcm->tcm_info = TC_H_MAKE(tp->prio, be16_to_cpu(tp->protocol));
> > if (nla_put_string(skb, TCA_KIND, tp->ops->kind))
> > goto nla_put_failure;
> > if (nla_put_u32(skb, TCA_CHAIN, tp->chain->index))
> > @@ -2692,7 +2692,7 @@ static bool tcf_chain_dump(struct tcf_chain *chain, struct Qdisc *q, u32 parent,
> > TC_H_MAJ(tcm->tcm_info) != tp->prio)
> > continue;
> > if (TC_H_MIN(tcm->tcm_info) &&
> > - TC_H_MIN(tcm->tcm_info) != tp->protocol)
> > + TC_H_MIN(tcm->tcm_info) != be16_to_cpu(tp->protocol))
> > continue;
> > if (*p_index > index_start)
> > memset(&cb->args[1], 0,
>
> I don't believe there's something to fix here
Hi,
as there are two patches addressing similar problems let's discuss
an appropriate approach (or not) in one place. I'd like to suggest here:
Link: https://lore.kernel.org/netdev/20231120100417.GM186930@vergenet.net/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-20 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17 10:18 [PATCH] net: sched: Fix restricted __be16 degrades to integer Kunwu Chan
2023-11-17 12:06 ` Pedro Tammela
2023-11-20 10:07 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).