From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 048413BED1E for ; Wed, 20 May 2026 17:02:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779296532; cv=none; b=k9RxDW757C2pJbrYYBnOSr366c3FU5IDdXF0fSPnGZLkTGJ8Akfax70KeWqcgldLS8nsLdI83+o89fKXYSxLs79xc7CiZ2NQP+dcMUDjv18s1fvZ1gxHhrAhAmboBzqEnOh69aiGo0K51cGSItN5t6O+WrFjAMD6qKxQl9DNh98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779296532; c=relaxed/simple; bh=O6G8WdCik1llgicpPWOHlMhn4UH0TvFLdwTcDPDeTxc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HuDouMHgMcWZLFwewzL/1pHS+wsOCbAtFNDaN5HfS/L9lXib4fPuUvbCC2KTRVmJFwYHwLbjB78wLjktsk/Wq/xIWV65DW99DhKw+2TKswn6p0lCx9f5KoBOkeqlIhEsAyrxXGKRfoIeRYV86h8tzMZ+SFCtINUQ0vy6w83s8Xs= 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=lLWssbL7; arc=none smtp.client-ip=209.85.210.174 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="lLWssbL7" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-83d53f307fdso181792b3a.3 for ; Wed, 20 May 2026 10:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779296530; x=1779901330; 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=Isi+zER6DUs/rJzPlPArDIqwo3ghYelS1e5SbW3Q7HY=; b=lLWssbL7MqLchIaJxHv61XneXA7J+PhyI3L0DD28xCVwc8uLluYiH7BjkUK/jBJLCF T3pjOw37Mdp9nzbisDLHybO3HsqkUdWqbfKMJ0ZoI6dp1GrM+zVCUUkEB+WrVsvN1TsM +4O7bAbb5+OBd2986whFypWN7rZyVHQT0RQWrJ9rOd3koDmV6+uM8UYNqeQcb2kQXl5J mvwCjxWUNsq37kSKacikYkV1y+lBKs5J65vxNHZYPOjlzXPfPHV9kfdz23kkAlgecLoD k16XTA0qnu/T3x2OVhf58/5xlmf9NhYxRSXPNPa3P/CiT2BpSHMnGgfu8YEanM0OCG9L 1/kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779296530; x=1779901330; 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=Isi+zER6DUs/rJzPlPArDIqwo3ghYelS1e5SbW3Q7HY=; b=cw72VQYPK28jFs3mRFi9HUGXDGT21GG66udzro0QbKz7LlN2qgPVVK54koFqvfA+JD 25TQWmS+eH5ldzQ0/rrY0EWKeIgNMr3fHH3dEOgL2StEVenSKiiInHVIaB8LWxDtIN6E 2kfRBux98rVnaOSzyR+EqS5q02Iah3Tls+XCi8ci0Ui8hdH2WS9UmdT21nWBtqck9X0i eBEhbv/KUilpSlEEjmuQ03JwUvxVa+d2OffB9gIYfdaeSErVwQN8qA/lXSRxtp9w7Dw2 qREA4+sU9g/TxopSPKDYsa4jPhSU6KMAVPzfqwsNiwMS3vbudQ9Gzx/GPR7cQRLwBKtM E/Gw== X-Forwarded-Encrypted: i=1; AFNElJ+W7KpwNNgxm4vgEcb0PZlpGR9Vr9q8GwiCNxCIkklQgVXdYwHLkp7mNSmP2sef7F0zyxZpBsp3FGfnDoI=@vger.kernel.org X-Gm-Message-State: AOJu0YwEiGuWEILyQmG2LT8RG8RY1x+kfbG/DW62kTZ8Xss6a9DvbOoZ XVhsHyZJjabacAK7rGmu7ca80NQCOg+ReBciLwnAjDjIWeiw6SLPQyHk X-Gm-Gg: Acq92OHJgToTRBErhj+GgXj/FGM8KiVMN6RdJJroySDRLEuKIbLs/eHLn28b+TN8Gzy fFqWqIiRqlwu+Ep7jPXtCR3mm52ihCngYchtREqFTI/kiICQQUgonh9WdRa7lk+8rNw+vs73KIn kc1CrPMslBFKqeGXkhqXu/4A7UvS/TowFFqN3AA9+Hif6inMuQrYf61uDOmZPvoTUmsE1SgOniM 8mm3Tir5i1nfZDzjJwHyaA/wHsS4f2aTxbkOmfE1osNe45ePSV0kabZ3+UCNSAReGzcQlQM3qSS 7VAzvThovwyoyo//V9CF6i9Q/npM4SXGzYmgdAepehaWDpKwStBN/NDGDk14Bsm6DU81QO0Dvxe G2gIHiG1l9JGgG7eeBcVkKPMlY29GpZbkzy7tUnI7Iulhgh+Hbg== X-Received: by 2002:a05:6a00:2d8a:b0:82d:1faf:775f with SMTP id d2e1a72fcca58-83f33da4fbfmr13178543b3a.5.1779296530240; Wed, 20 May 2026 10:02:10 -0700 (PDT) Received: from ser8.. ([221.156.231.192]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83f1942a83fsm22125954b3a.0.2026.05.20.10.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 10:02:09 -0700 (PDT) From: DaeMyung Kang To: Namjae Jeon Cc: Hyunchul Lee , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, DaeMyung Kang Subject: [PATCH 3/3] ntfs: only alias volume $UpCase to default on exact match Date: Thu, 21 May 2026 02:01:51 +0900 Message-ID: <20260520170151.4115308-4-charsyam@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260520170151.4115308-1-charsyam@gmail.com> References: <20260520170151.4115308-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 --- super.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/super.c b/super.c index c90cb5673f98..811640cf5669 100644 --- a/super.c +++ b/super.c @@ -1344,7 +1344,6 @@ static bool load_and_init_upcase(struct ntfs_volume *vol) #endif 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. */ @@ -1405,16 +1404,11 @@ read_partial_upcase_page: 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