From patchwork Tue Nov 12 09:54:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 13871994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 604FFD32D7F for ; Tue, 12 Nov 2024 09:54:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0D566B008C; Tue, 12 Nov 2024 04:54:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DB31C6B0095; Tue, 12 Nov 2024 04:54:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2D1C6B00EB; Tue, 12 Nov 2024 04:54:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A41FF6B008C for ; Tue, 12 Nov 2024 04:54:54 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 55F48A0565 for ; Tue, 12 Nov 2024 09:54:54 +0000 (UTC) X-FDA: 82776982008.13.AED4127 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by imf18.hostedemail.com (Postfix) with ESMTP id 9C7051C001D for ; Tue, 12 Nov 2024 09:54:33 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="gX/oL5OP"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of colin.i.king@gmail.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=colin.i.king@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731405229; a=rsa-sha256; cv=none; b=lfN24c9ZUY+6KiA6ZzPmK9T/o+Mke3tkctkxa16KA0DmqnDSvI3j847Pjjv487QapgXou8 ritWWCbVRMLkKeIVLMZCt4ozqZhjyvxtO7Zw4r6SuIE5HG1ge++gHdOaZO8mtUHEcvzzW+ DLm/fkT8WLXGN3QWLbJKg4bgG2Em1H8= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="gX/oL5OP"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of colin.i.king@gmail.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=colin.i.king@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731405229; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=qaivvDChRb0InDJ8FMMWKeFE9ZD3AcLndPDWrjVqzRQ=; b=HbaCIuhmEysn8AuUhVi2FM1Z/5B5soMavpP7KXntPELbNA06doCxVQhfFTMm6V0tTnKm+0 NxsJfgN+BwcWkKLr9vC9lD7kVRRozI7HeVeK1c+0mjrtDEr6eDzdi+7qKH95LvYa0Scjyy M24fazd460riEmfE89zw6gHBwpLr5Pk= Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-431616c23b5so31133455e9.0 for ; Tue, 12 Nov 2024 01:54:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731405290; x=1732010090; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qaivvDChRb0InDJ8FMMWKeFE9ZD3AcLndPDWrjVqzRQ=; b=gX/oL5OP0AILpJJPcWOS/59Z/3AOHE9s57EYQ/YSV4YAgNyrxR5q1enWNpndzWWb3e +YoCtpFGpFCHEuI9evE/dEHFY2ZTCzyVUf2IYkggevxDSXvajfEbo90NYyOj6IwfSb+E bep6TE+wltg07ngHqsoNWSrMtENK9cRejxJZgXvCu+70KInfBpp7YrHOsxoe23UMcojS 8Fb08CCFa7WbCeXGh4vSluh8uN/r3vEmqHtAo8tv+ix6hPoZh9V7Lr0grRVMaG+GrDHs ZTXwvDX+g/zdamFfPtTxf/ejB1+ioD+kPq6x2s6QkSRoUNuL5ObxQPDDAEzFste5Ge6D rAwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731405290; x=1732010090; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qaivvDChRb0InDJ8FMMWKeFE9ZD3AcLndPDWrjVqzRQ=; b=FKuFRZwLNb2EtdCp2VrID79nQLS7FcJYg9N1tN6w5gy7RZzdJD3T0PgVL4JXFfMTcq NrvmzesJk7BOGIUbSAfN6k49Tp11WE170sZVzLT18m5BkU5uLIJPMXXokLSagddcbi+U SnkwVjJL7XR7/i64jvSM+ntZh/hypdHMt5NX3opL7j7uwRbHdA5EyTNQeJf+G4+QADiG TrZdrMrwqUvybhvBuiQzAXq8DtfTxkzYznxtoWMDnrha+Esf212k8z66XJ+tTCosEkuw HPQIjrQCL8NQdwmtVfG4QRzdKS3CMmpo0BoUGaNEmLBUdhEKZ2TXChwOfDyqvi2ZAtkM hM3A== X-Forwarded-Encrypted: i=1; AJvYcCUXf/R0X5gHjvK00ZKCfW2PzVlMWDFNEJAUHmtIl/ebxd9Efwol+ouXQ3EZZxoqATrrmivlnLMT6w==@kvack.org X-Gm-Message-State: AOJu0YzD7qxD3mxZYAR0v0woLuyH542QSKYYVlcQCy5CcQPeyn8gcXxj 3/O9X+nlftq3mvX22KoHI7ddpi1zT3MUWJZCJAdi2PHSvRzU+YuD X-Google-Smtp-Source: AGHT+IH6q+2c0ZvH4Mqyc5GpFUfzI4kxFJ9JrF8Pz4fdBojwceABr9m8BAiE7+L6NGf3ItAa2jqiGA== X-Received: by 2002:a05:600c:3ba9:b0:431:47e7:9f45 with SMTP id 5b1f17b1804b1-432b686ec45mr142761445e9.11.1731405290361; Tue, 12 Nov 2024 01:54:50 -0800 (PST) Received: from localhost ([194.120.133.65]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432aa74bab3sm238757095e9.43.2024.11.12.01.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 01:54:50 -0800 (PST) From: Colin Ian King To: Hugh Dickins , Andrew Morton , Gabriel Krisman Bertazi , Christian Brauner , =?utf-8?q?Andr=C3=A9_Almeida?= , linux-mm@kvack.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] mm: shmem: Fix error checking on utf8_parse_version failures Date: Tue, 12 Nov 2024 09:54:49 +0000 Message-Id: <20241112095449.461196-1-colin.i.king@gmail.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 9C7051C001D X-Rspamd-Server: rspam01 X-Stat-Signature: 1czk5wnsxkd33jw99pyqnmxuhzfcqrsz X-HE-Tag: 1731405273-706613 X-HE-Meta: U2FsdGVkX1/bGa287dyqJJvIkuWV93s0q7C6teBuPVasb0hQppQpUC+WBt2aMalcNw/llh2XJAyy9sq7nU2vRs7UM8wLQ+zl5RNsll3UBxI9oLr29suTgTgfj2mZJq+OEP3bgdRRorysywkiDVhRvKdNVyxLcCZPgtMO/68pL5C1DhKJ5Leca0EtbwuA8WnaRlV2wEenbfrkzrw8ls06Dbea6jfhhRMZ6dAPnJ4uyHeJfkovZ3aiYa7oFItNWhf5QEdZLYcA5RoeTLGQs+NcCoYNJ4q/EbfGINMBWqPUMzeexL5PBxAfzxze1CPJEfdK7vAio3RFmef+2+1swP6U5OQUExsda7LX3tYCucm3InZM7tJiN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Bik2oizvQTKbGcfnguB0NK/9N60ZGw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000344, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Currently the error check on the call to utf8_parse_version is always false because version is an unsigned int and this can never be less than zero. Because version is required to be an unsigned int, fix the issue by casting it to int just for the error check. Fixes: 58e55efd6c72 ("tmpfs: Add casefold lookup support") Signed-off-by: Colin Ian King --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 7987deb2be9b..b69e1d8816fa 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4377,7 +4377,7 @@ static int shmem_parse_opt_casefold(struct fs_context *fc, struct fs_parameter * "in the format: utf8-"); version = utf8_parse_version(version_str); - if (version < 0) + if ((int)version < 0) return invalfc(fc, "Invalid UTF-8 version: %s", version_str); }