[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250403165702.396388-4-irogers@google.com>
Date: Thu, 3 Apr 2025 09:57:00 -0700
From: Ian Rogers <irogers@...gle.com>
To: Yury Norov <yury.norov@...il.com>, Rasmus Villemoes <linux@...musvillemoes.dk>,
Arnd Bergmann <arnd@...db.de>, Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>, Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>, Thomas Gleixner <tglx@...utronix.de>,
Jakub Kicinski <kuba@...nel.org>, Jacob Keller <jacob.e.keller@...el.com>, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: [PATCH v1 3/5] bitops: Silence a clang -Wshorten-64-to-32 warning
The clang warning -Wshorten-64-to-32 can be useful to catch
inadvertent truncation. In some instances this truncation can lead to
changing the sign of a result, for example, truncation to return an
int to fit a sort routine. Silence the warning by making the implicit
truncation explicit.
Signed-off-by: Ian Rogers <irogers@...gle.com>
---
include/asm-generic/bitops/fls64.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/asm-generic/bitops/fls64.h b/include/asm-generic/bitops/fls64.h
index 866f2b2304ff..9ad3ff12f454 100644
--- a/include/asm-generic/bitops/fls64.h
+++ b/include/asm-generic/bitops/fls64.h
@@ -21,7 +21,7 @@ static __always_inline int fls64(__u64 x)
__u32 h = x >> 32;
if (h)
return fls(h) + 32;
- return fls(x);
+ return fls((__u32)x);
}
#elif BITS_PER_LONG == 64
static __always_inline int fls64(__u64 x)
--
2.49.0.504.g3bcea36a83-goog
Powered by blists - more mailing lists