Thread (60 messages) flat view 60 messages, 8 authors, 2024-10-28

Re: [PATCH v1 03/14] futex: Flag conversion

From: Thomas Gleixner <hidden>
Date: 2023-07-31 16:22:10
Also in: linux-arch, linux-mm, lkml

On Fri, Jul 21 2023 at 12:22, Peter Zijlstra wrote:
+
+static inline bool futex_flags_valid(unsigned int flags)
+{
+	/* Only 64bit futexes for 64bit code */
+	if (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall()) {
+		if ((flags & FLAGS_SIZE_MASK) == FLAGS_SIZE_64)
+			return false;
+	}
+
+	/* Only 32bit futexes are implemented -- for now */
+	if ((flags & FLAGS_SIZE_MASK) != FLAGS_SIZE_32)
+		return false;
+
+	return true;
+}
+
+static inline unsigned int futex_size(unsigned int flags)
+{
+	unsigned int size = flags & FLAGS_SIZE_MASK;
+	return 1 << size; /* {0,1,2,3} -> {1,2,4,8} */
Lacks a new line and the comment is both misplaced and kinda obvious, no?

Other than that, this looks abour right.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help