mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nls: fix byte order conversion warnings in get_utf16()
@ 2025-11-12  8:33 HsuehBo
  0 siblings, 0 replies; only message in thread
From: HsuehBo @ 2025-11-12  8:33 UTC (permalink / raw)
  To: linux-kernel, trondmy, anna; +Cc: linux-nfs, linux-fsdevel, HsuehBo, Hsueh Bo

From: Hsueh Bo <HsuehBo@126.com>

Add proper __force type casting to resolve sparse warnings
about restricted __le16/__be16 conversions in get_utf16() function.

This fixes the following sparse warnings:
fs/nls/nls_base.c:180:24: warning: cast to restricted __le16
fs/nls/nls_base.c:182:24: warning: cast to restricted __be16

Signed-off-by: Hsueh Bo <HsuehBo@126.com>
---
 fs/nls/nls_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c
index 18d597e49a19..4c6fa02e01d6 100644
--- a/fs/nls/nls_base.c
+++ b/fs/nls/nls_base.c
@@ -177,9 +177,9 @@ static inline unsigned long get_utf16(unsigned c, enum utf16_endian endian)
 	default:
 		return c;
 	case UTF16_LITTLE_ENDIAN:
-		return __le16_to_cpu(c);
+		return __le16_to_cpu((__force __le16)c);
 	case UTF16_BIG_ENDIAN:
-		return __be16_to_cpu(c);
+		return __be16_to_cpu((__force __be16)c);
 	}
 }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-12  9:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-12  8:33 [PATCH] nls: fix byte order conversion warnings in get_utf16() HsuehBo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®