linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Karan Sanghavi <karansanghvi98@gmail.com>
To: "Hugh Dickins" <hughd@google.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Gabriel Krisman Bertazi" <gabriel@krisman.be>,
	"André Almeida" <andrealmeid@igalia.com>,
	"Christian Brauner" <brauner@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Shuah Khan <skhan@linuxfoundation.org>,
	 Karan Sanghavi <karansanghvi98@gmail.com>
Subject: [PATCH v3] mm: shmem: Use signed int for version handling in casefold option
Date: Sat, 11 Jan 2025 15:31:30 +0000	[thread overview]
Message-ID: <20250111-unsignedcompare1601569-v3-1-c861b4221831@gmail.com> (raw)

Fixes an issue where the use of an unsigned data type in
`shmem_parse_opt_casefold()` caused incorrect evaluation of
negative conditions.

Fixes: 58e55efd6c72 ("tmpfs: Add casefold lookup support")
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Reviewed-by: Gabriel Krisman Bertazi <gabriel@krisman.be>
Signed-off-by: Karan Sanghavi <karansanghvi98@gmail.com>
---
Coverity Message:
CID 1601569: (#1 of 1): Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned 
value is never true. version < 0U

Coverity Link:
https://scan7.scan.coverity.com/#/project-view/10043/11354?selectedIssue=1601569
---
Changes in v3:
- Changed patch subject adn summary log. 
- Link to v2: https://lore.kernel.org/r/20241127-unsignedcompare1601569-v2-1-e85098fb02b2@gmail.com

Changes in v2:
- Updated the log summary.
- Link to v1: https://lore.kernel.org/r/20241111-unsignedcompare1601569-v1-1-c4a9c3c75a52@gmail.com
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 7987deb2be9b..17a1d4fa8870 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -4367,7 +4367,7 @@ static int shmem_parse_opt_casefold(struct fs_context *fc, struct fs_parameter *
 				    bool latest_version)
 {
 	struct shmem_options *ctx = fc->fs_private;
-	unsigned int version = UTF8_LATEST;
+	int version = UTF8_LATEST;
 	struct unicode_map *encoding;
 	char *version_str = param->string + 5;
 

---
base-commit: 6d59cab07b8d74d0f0422b750038123334f6ecc2
change-id: 20241111-unsignedcompare1601569-05b5932145ef

Best regards,
-- 
Karan Sanghavi <karansanghvi98@gmail.com>



             reply	other threads:[~2025-01-11 15:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-11 15:31 Karan Sanghavi [this message]
2025-01-13 14:44 ` Christian Brauner

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=20250111-unsignedcompare1601569-v3-1-c861b4221831@gmail.com \
    --to=karansanghvi98@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrealmeid@igalia.com \
    --cc=brauner@kernel.org \
    --cc=gabriel@krisman.be \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=skhan@linuxfoundation.org \
    /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