mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Wengang Wang <wen.gang.wang@oracle.com>,
	Junrui Luo <moonafterrain@outlook.com>
Cc: Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
	Sunil Mushran <sunil.mushran@oracle.com>,
	"ocfs2-devel@lists.linux.dev" <ocfs2-devel@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Yuhao Jiang <danisjiang@gmail.com>
Subject: Re: [PATCH 0/2] ocfs2/dlm: fix two bugs in dlm_match_regions()
Date: Mon, 9 Mar 2026 09:26:44 +0800	[thread overview]
Message-ID: <0ea3f3f9-8d3c-4ef4-b54b-c5594531f573@linux.alibaba.com> (raw)
In-Reply-To: <00EF98C8-5E0C-4778-9506-E6C2F54FB93B@oracle.com>



On 3/8/26 12:06 AM, Wengang Wang wrote:
> The two patches looks good to me.
> 
> Reviewed-by: Wengang Wang <wen.gang.wang@oracle.com <mailto:wen.gang.wang@oracle.com>>
> 
> Just unrelated to these patches, looking at function o2hb_get_all_regions,
> 
> 2519 int o2hb_get_all_regions(char *region_uuids, u8 max_regions)
> 2520 {
> 2521         struct o2hb_region *reg;
> 2522         int numregs = 0;
> 2523         char *p;
> 2524
> 2525         spin_lock(&o2hb_live_lock);
> 2526
> 2527         p = region_uuids;
> 2528         list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) {
> 2529                 if (reg->hr_item_dropped)
> 2530                         continue;
> 2531
> 2532                 mlog(0, "Region: %s\n", config_item_name(&reg->hr_item));
> 2533                 if (numregs < max_regions) {
> 2534                         memcpy(p, config_item_name(&reg->hr_item),
> 2535                                O2HB_MAX_REGION_NAME_LEN);
> 2536                         p += O2HB_MAX_REGION_NAME_LEN;
> 2537                 }
> 2538                 numregs++;
> 2539         }
> 2540
> 2541         spin_unlock(&o2hb_live_lock);
> 2542
> 2543         return numregs;
> 2544 }
> 
> It seems that ‘numregs’ can mismatch with ‘region_uuids' (line 2538 VS line 2534) due to the limitation of ‘max_regions’
> though calling o2hb_get_all_regions() with max_regions being O2NM_MAX_REGIONS looks good.
> 

Yes, it looks wried here.
So why not fix it by moving 'numregs++' into if clause?

Thanks,
Joseph


      parent reply	other threads:[~2026-03-09  1:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-07  7:22 Junrui Luo
2026-03-07  7:21 ` [PATCH 1/2] ocfs2/dlm: validate qr_numregions " Junrui Luo
2026-03-18  5:54   ` Joseph Qi
2026-03-07  7:21 ` [PATCH 2/2] ocfs2/dlm: fix off-by-one in dlm_match_regions() region comparison Junrui Luo
2026-03-18  5:55   ` Joseph Qi
2026-03-07 16:06 ` [PATCH 0/2] ocfs2/dlm: fix two bugs in dlm_match_regions() Wengang Wang
2026-03-07 16:14   ` Wengang Wang
2026-03-09  1:26   ` Joseph Qi [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=0ea3f3f9-8d3c-4ef4-b54b-c5594531f573@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=danisjiang@gmail.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=moonafterrain@outlook.com \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=sunil.mushran@oracle.com \
    --cc=wen.gang.wang@oracle.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

all inboxes | Powered by JetHome®