Skip to contentSkip to conversation

fs: fat: Fix warning in normalize_longname()

PATCH Applied Tom Rini 2 participants 2 messages Sep 30, 2018 – Oct 16, 2018 VFAT/FAT/msdos filesystem

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 fs: fat: Fix warning in normalize_longname()

As observed with clang:
fs/fat/fat_write.c:1024:13: warning: comparison of constant 128

      with expression of type 'char' is always false
      [-Wtautological-constant-out-of-range-compare]
                if ((0x80 <= c) && (c <= 0xff))
                     ~~~~ ^  ~
fs/fat/fat_write.c:1024:25: warning: comparison of constant 255
      with expression of type 'char' is always true
      [-Wtautological-constant-out-of-range-compare]
                if ((0x80 <= c) && (c <= 0xff))
                                    ~ ^  ~~~~
Fixes 25bb9dab14f4 ("fs: fat: check and normalize file name")
Cc AKASHI Takahiro <[email protected]>
Cc Alexander Graf <[email protected]>
---
 fs/fat/fat_write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fat/fat_write.c +1 -1
index fc211e74bc69..98fe6b2b4ecc 100644
@@ -1005,7 +1005,7 @@ again:
 static int normalize_longname(char *l_filename, const char *filename)
 {
 	const char *p, legal[] = "!#$%&\'()-.@^`_{}~";
-	char c;
+	unsigned char c;
 	int name_len;
 
 	/* Check that the filename is valid */
Signature · 1 line
2.7.4
#1 lore raw
Quoted 12 lines

As observed with clang:
fs/fat/fat_write.c:1024:13: warning: comparison of constant 128

      with expression of type 'char' is always false
      [-Wtautological-constant-out-of-range-compare]
                if ((0x80 <= c) && (c <= 0xff))
                     ~~~~ ^  ~
fs/fat/fat_write.c:1024:25: warning: comparison of constant 255
      with expression of type 'char' is always true
      [-Wtautological-constant-out-of-range-compare]
                if ((0x80 <= c) && (c <= 0xff))
                                    ~ ^  ~~~~
Quoted 4 lines
Fixes 25bb9dab14f4 ("fs: fat: check and normalize file name")
Cc AKASHI Takahiro <[email protected]>
Cc Alexander Graf <[email protected]>

Thanks, applied to efi-2018.11

Alex