From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: fs/hfsplus/unicode.c:496:24-25: WARNING opportunity for swap()
Date: Tue, 17 Nov 2026 17:30:21 +0100 [thread overview]
Message-ID: <20261117172832.VeDFg2Mm-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Viacheslav Dubeyko <slava@dubeyko.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4
commit: bbe5ebcbc006ac3c7353759fc593fb7cb7de76a1 hfsplus: canonicalize decomposed catalog names like fsck_hfs expects
date: 8 weeks ago
:::::: branch date: 23 hours ago
:::::: commit date: 8 weeks ago
config: arm64-randconfig-r2109-20261116 (https://download.01.org/0day-ci/archive/20261117/20261117172832.VeDFg2Mm-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 5637411ce5dc86d0b7f87cde0f7ee47406d29db6)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: bbe5ebcbc006 ("hfsplus: canonicalize decomposed catalog names like fsck_hfs expects")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/20261117172832.VeDFg2Mm-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> fs/hfsplus/unicode.c:496:24-25: WARNING opportunity for swap()
vim +496 fs/hfsplus/unicode.c
afd6c9e1f5287a Ernesto A. Fernández 2018-08-21 461
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 462 /*
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 463 * Apply the Unicode Canonical Ordering Algorithm to a decomposed name held
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 464 * as plain host-order code units: within each maximal run of characters
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 465 * that have a nonzero combining class, stable-sort the run into ascending
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 466 * combining-class order. A character with combining class 0 always starts
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 467 * a new run and is never itself reordered.
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 468 *
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 469 * hfsplus_decompose_table decomposes each source character on its own; it
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 470 * says nothing about how the decompositions of two different source
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 471 * characters should be ordered relative to each other when both produce
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 472 * combining marks that end up adjacent. Without this pass, such a
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 473 * sequence can be stored in an order that macOS's own fsck_hfs
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 474 * (FixDecomps() in CatalogCheck.c) considers illegal, even though every
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 475 * individual character was decomposed correctly.
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 476 */
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 477 static void hfsplus_canonical_reorder(u16 *ustr, int len)
1e96b7ca1e8f17 Duane Griffin 2007-07-15 478 {
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 479 int i;
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 480
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 481 for (i = 1; i < len; i++) {
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 482 u8 cls = hfsplus_combining_class(ustr[i]);
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 483 int j = i;
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 484
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 485 if (!cls)
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 486 continue;
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 487
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 488 while (j > 0) {
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 489 u8 prev_cls = hfsplus_combining_class(ustr[j - 1]);
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 490 u16 tmp;
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 491
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 492 if (!prev_cls || prev_cls <= cls)
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 493 break;
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 494
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 495 tmp = ustr[j];
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 @496 ustr[j] = ustr[j - 1];
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 497 ustr[j - 1] = tmp;
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 498 j--;
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 499 }
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 500 }
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 501 }
bbe5ebcbc006ac Viacheslav Dubeyko 2026-09-18 502
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-11-17 16:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261117172832.VeDFg2Mm-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.