From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E9D439E6C6 for ; Thu, 21 May 2026 10:18:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779358690; cv=none; b=W0ktcGbl+pAHezelZ6esVbsBauTWqGgE9KiFpAAjUSS2g2YAvNCzrDfGiBdPCXhFbllxJYErou1LImxULpAcqXqFOJs1Il2YpwMMIVviN3YYVydfEt7E5FOgwidg1ToLa2IRXC42N3w8SqrongoysXu4Vccnrf0IGi0vweIT6fs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779358690; c=relaxed/simple; bh=vwsQZ2R3eKTkCSRO/SpyoNW9ls59kUMMez9Nn4L1k78=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jtbUqALbqDUPGsJK0lJrVpPabG6bDECvtcdwVvqJgXaPNuNiZKK5ZhoNGoADuqyWW9B0I53uS84UNBYxlZNKxwn+EFF1azXvdBQ7I6vSyIMGSXqqaWyVUJOAA65NLemp+t6BDhpjz9CUrdOhxYoTg7XwMl4rtPGZGhun2TlWBF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VsUX/LBz; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VsUX/LBz" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-365de41f8a1so710990a91.2 for ; Thu, 21 May 2026 03:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779358688; x=1779963488; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7FhPZ6mwbYBBt75MdFT5zKA1xzkMlLRUIuzLsq8lvBg=; b=VsUX/LBzf33hxA1eD+3CfsxDMlLPBta2y2MpVfH0AOBMGCe5DZV6SV+N73JmY9/WHL gl+ZJaLC4wYG3cl2UnyuMed2L5uuNS3/Ork/G/pEKKYN6nzodSbWKtSdx2j4Y08jMgiW HuirzGp0SLHbvRCCx3ePO0KHy6wEQhPPIHHW7ZdsVqYqclMleKAz15H6i8soW65zjaFL A2ChrJ4E7UJmd/CA9BRbTRjarjlmYV80GePYmOqOk6gZ7pprHaArQTmyaIlsG5ImdvZs M2n/mLb16+nCIavCSDe7BWSMs1yrkmXpV/IFf/KCH8Px1w3wUCBC4iRxk+1I8kyap5nF 56Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779358688; x=1779963488; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7FhPZ6mwbYBBt75MdFT5zKA1xzkMlLRUIuzLsq8lvBg=; b=CaVNGVBzUM4lErNxc/i2g8iV+v4iAzzkd+H0P6kHeKgIW1sI3ZPz8KZ4BVMn+p4EQ1 fcPHyXlV3r1KcDiOhfSswWBwXUnyYh5Y/1QULvrGvJ1eVkE572HTJrMmJzs9IsvNIOhj xhUVZKoBIFWsFda7aESKasjKAsPdvLrjqyZ72SzDnfAr7CDAJnofFrZ3ZvUJgvrIKAaq lYGq7Q9HaBW1ZF1EInXJN+KN4MvOwaC1mnOCtpwPVTVaenVIsds+nFXkGIjzsxOLSV69 Ly7P1sysFE92LLe3JMZiWmqabrgAcg86nKrOZ/xs8iD0F6NsMEEp3lsy+sZMPWo96Pj1 B/0A== X-Forwarded-Encrypted: i=1; AFNElJ9WpQnBupIKWOa9a9CAskG8bD9907fJOi0kgAhq8Y2FwTPq40m0/s/7ouMcY3ZsK1R7iuCQkqWGR6WcXfg=@vger.kernel.org X-Gm-Message-State: AOJu0YwdakXMoPIcLYilAt0Fx+aN9sGBJdUqMEg0l3NiIsyYa4ASkYGq JHML5uJrZdzOjjp0PL5tt6EIzdbFWhpXrzVjAGyNRL2TJXHDaISDXPJM X-Gm-Gg: Acq92OEwxy0V8c+EqOWR9tG55ZOosuMi0u31ZVSLabhvHzPCMRDgwnRCyVpN3x/JVt4 fA/k9FOsgi9OPpkW/QXRLDoKWDFMlNUKIJ5D3KRQDzM8BPwGYrTl/zyEnNW41dmay3wTtLkoJXR L9wBs4WhB4yFa/9zhnP/XE73L7T9VSKvVMi8SuOIdz9PlcMFVeWFWec68NqA78bfDaUPZeIZIvG tX0eptCL6UeO6DgZcZIeh2n+Jp+AdctcvSIggSonRzWAlJnqHWJfHSHwwpV8UhMu2zbQhyw/a62 R25c3yEEXyBWoluDp9HbNYDcClffJKfEktOnRe+4LausPkOB9WKyYArmqysg6z1xu7pau36Akz6 QVr64STEHupnv3Uf1bezUI/Vg4ir1w6NPOT8sRyzs1ys0PcdY0mcu2ySClgKRTcg6TmprRgal6v RaoS3BZrQsSU4bz6fy X-Received: by 2002:a05:6a20:9f08:b0:39c:68ed:9a39 with SMTP id adf61e73a8af0-3b308791329mr1429889637.6.1779358688285; Thu, 21 May 2026 03:18:08 -0700 (PDT) Received: from ser8.. ([221.156.231.192]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84154e1fc86sm1197799b3a.44.2026.05.21.03.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 03:18:07 -0700 (PDT) From: DaeMyung Kang To: Namjae Jeon , Hyunchul Lee Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, DaeMyung Kang Subject: [PATCH v2 3/3] ntfs: only alias volume $UpCase to default on exact match Date: Thu, 21 May 2026 19:17:51 +0900 Message-ID: <20260521101751.591345-4-charsyam@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260521101751.591345-1-charsyam@gmail.com> References: <20260520170151.4115308-1-charsyam@gmail.com> <20260521101751.591345-1-charsyam@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit load_and_init_upcase() currently aliases vol->upcase to the global default upcase whenever the shared prefix matches, and then truncates vol->upcase_len to that shorter prefix. The result is correct only by accident: upcase[] accesses in name collation are gated by upcase_len, so the prefix-equality alias produces the same fold output as keeping the volume's own shorter table. Still, prefix equality is not equality: the volume table is logically distinct from the default and should not be replaced by it unless they are byte-for-byte identical. Use memcmp() to compare the complete table in one expression and drop the now-redundant upcase_len rewrite. No user-visible change is expected for compliant volumes whose $UpCase has exactly default_upcase_len entries; shorter volume tables are no longer aliased to the default. Signed-off-by: DaeMyung Kang --- fs/ntfs/super.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 14fd244f29fe..971c2822f5e3 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -1323,7 +1323,6 @@ static bool load_and_init_upcase(struct ntfs_volume *vol) u8 *addr; pgoff_t index, max_index; unsigned int size; - int i, max; ntfs_debug("Entering."); /* Read upcase table and setup vol->upcase and vol->upcase_len. */ @@ -1374,16 +1373,11 @@ static bool load_and_init_upcase(struct ntfs_volume *vol) mutex_unlock(&ntfs_lock); return true; } - max = default_upcase_len; - if (max > vol->upcase_len) - max = vol->upcase_len; - for (i = 0; i < max; i++) - if (vol->upcase[i] != default_upcase[i]) - break; - if (i == max) { + if (default_upcase_len == vol->upcase_len && + !memcmp(vol->upcase, default_upcase, + default_upcase_len * sizeof(*default_upcase))) { kvfree(vol->upcase); vol->upcase = default_upcase; - vol->upcase_len = max; ntfs_nr_upcase_users++; mutex_unlock(&ntfs_lock); ntfs_debug("Volume specified $UpCase matches default. Using default."); -- 2.43.0