public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Tao Cui <cuitao@kylinos.cn>
Cc: cgroups@vger.kernel.org, hannes@cmpxchg.org, mkoutny@suse.com
Subject: Re: [PATCH v3] cgroup/rdma: refactor resource parsing with match_table_t/match_token()
Date: Wed, 22 Apr 2026 07:25:04 -1000	[thread overview]
Message-ID: <aekEcJoPGpy72yo0@slm.duckdns.org> (raw)
In-Reply-To: <20260422021709.333689-1-cuitao@kylinos.cn>

On Wed, Apr 22, 2026 at 10:17:09AM +0800, Tao Cui wrote:
> Replace the hand-rolled strsep/strcmp/match_string parsing in
> rdmacg_resource_set_max() with a match_table_t and match_token()
> pattern, following the convention used by user_proactive_reclaim()
> and ioc_cost_model_write().
> 
> The old strncmp(value, RDMACG_MAX_STR, strlen(value)) also had two
> bugs that are fixed by this refactor:
> 
>   - It matched "ma" as "max" because strncmp only compared the
>     shorter strlen(value) bytes.
> 
>   - It silently accepted "hca_handle=" (empty value) as "max"
>     because strncmp with n=0 always returns 0.
> 
> The match_token() approach also robustly handles extra whitespace in
> the input by splitting on " \t\n" and skipping empty tokens.
> 
> Suggested-by: "Michal Koutný" <mkoutny@suse.com>
> Signed-off-by: Tao Cui <cuitao@kylinos.cn>

Looks fine to me, Michal?

Thanks.

-- 
tejun

      reply	other threads:[~2026-04-22 17:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14  2:09 [PATCH] cgroup/rdma: fix strncmp prefix match in parse_resource() cuitao
2026-04-15 13:37 ` Michal Koutný
2026-04-17  6:43   ` 崔涛
2026-04-17  9:53     ` Michal Koutný
2026-04-20  1:08       ` Tao Cui
2026-04-20  4:52       ` [PATCH v2] cgroup/rdma: refactor resource parsing with match_table_t/match_token() cuitao
2026-04-21 16:42         ` Tejun Heo
2026-04-22  2:17           ` [PATCH v3] " Tao Cui
2026-04-22 17:25             ` Tejun Heo [this message]

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=aekEcJoPGpy72yo0@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=cuitao@kylinos.cn \
    --cc=hannes@cmpxchg.org \
    --cc=mkoutny@suse.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