diff mbox series

[-mm] -funsigned-char, namei: delete cast in lookup_one_common()

Message ID Y1EbRNxRnZ/42G9x@localhost.localdomain (mailing list archive)
State New, archived
Headers show
Series [-mm] -funsigned-char, namei: delete cast in lookup_one_common() | expand

Commit Message

Alexey Dobriyan Oct. 20, 2022, 9:56 a.m. UTC
Cast to unsigned int doesn't do anything because two comparisons are
a) for equality, and
b) both '/' and '\0' have non-negative values.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 fs/namei.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2657,7 +2657,7 @@  static int lookup_one_common(struct user_namespace *mnt_userns,
 	}
 
 	while (len--) {
-		unsigned int c = *(const unsigned char *)name++;
+		char c = *name++;
 		if (c == '/' || c == '\0')
 			return -EACCES;
 	}