netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net] net/sched: tcindex: search key must be 16 bits
Date: Tue, 14 Feb 2023 14:46:26 -0800	[thread overview]
Message-ID: <20230214144626.262f5d58@hermes.local> (raw)
In-Reply-To: <20230214014729.648564-1-pctammela@mojatatu.com>

On Mon, 13 Feb 2023 22:47:29 -0300
Pedro Tammela <pctammela@mojatatu.com> wrote:

> diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
> index ba7f22a49..6640e75ea 100644
> --- a/net/sched/cls_tcindex.c
> +++ b/net/sched/cls_tcindex.c
> @@ -503,7 +503,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
>  		/* lookup the filter, guaranteed to exist */
>  		for (cf = rcu_dereference_bh_rtnl(*fp); cf;
>  		     fp = &cf->next, cf = rcu_dereference_bh_rtnl(*fp))
> -			if (cf->key == handle)
> +			if (cf->key == (u16)handle)
>  				break;

Rather than truncating silently. I think the code should first test that handle is
not outside of range and return EINVAL instead.

  reply	other threads:[~2023-02-14 22:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  1:47 [PATCH net] net/sched: tcindex: search key must be 16 bits Pedro Tammela
2023-02-14 22:46 ` Stephen Hemminger [this message]
2023-02-14 22:53   ` Jamal Hadi Salim
2023-02-15  9:36 ` Eric Dumazet
2023-02-15 10:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230214144626.262f5d58@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pctammela@mojatatu.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).