From: HsuehBo@126.com
To: linux-kernel@vger.kernel.org, trondmy@kernel.org, anna@kernel.org
Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
HsuehBo@outlook.com, Hsueh Bo <HsuehBo@126.com>
Subject: [PATCH] nls: fix byte order conversion warnings in get_utf16()
Date: Wed, 12 Nov 2025 16:33:24 +0800 [thread overview]
Message-ID: <20251112083324.60209-1-HsuehBo@126.com> (raw)
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
reply other threads:[~2025-11-12 9:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251112083324.60209-1-HsuehBo@126.com \
--to=hsuehbo@126.com \
--cc=HsuehBo@outlook.com \
--cc=anna@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.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
all inboxes | Powered by JetHome®