Thread (18 messages) 18 messages, 6 authors, 3h ago

Re: [PATCH v2] random: vDSO: Avoid call to memset() when zeroing reserved in __cvdso_getrandom_data()

From: Andreas Schwab <hidden>
Date: 2026-09-26 09:40:14
Also in: linux-arm-kernel, linux-riscv, linux-s390, lkml, llvm, loongarch

On Sep 25 2026, Nathan Chancellor wrote:
+#if __has_builtin(__builtin_memset_inline)
+#define memset_inline(dst, value, size) __builtin_memset_inline(dst, value, size)
+#elif IS_ENABLED(CONFIG_CC_HAS_OPT_INLINE_MEMSET)
+#define memset_inline(dst, value, size) __builtin_memset(dst, value, size)
+#else
+static inline void *memset_inline(void *dst, int value, size_t size)
+{
+	char *d = dst;
+
+	while (size--)
+		*d++ = value;
+
+	return d;
+}
+#endif
+
memset actually returns the original pointer, not the incremented one.
Nothing uses the return value of memset_inline here, but it is
confusing.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help