git: ca19c9296ad6 - stable/15 - <sys/extattr.h>: use designated initializers for EXTATTR_NAMESPACE_NAMES
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Apr 2026 13:49:10 UTC
The branch stable/15 has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=ca19c9296ad657216286f78ab23422f52ab6a073
commit ca19c9296ad657216286f78ab23422f52ab6a073
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-04-09 02:41:12 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-04-23 13:48:44 +0000
<sys/extattr.h>: use designated initializers for EXTATTR_NAMESPACE_NAMES
This is not a functional change, but it makes it more clear upon
inspection of the definition that the mapping property described is
preserved. Maybe more importantly, if one ends up getting an index
wrong or punching a hole in the name array unexpectedly, then it'll
hopefully manifest more clearly as a (null) or nullptr deref rather than
potentially just emitting the wrong namespace name.
It's noted that this almost certainly invalidates its use in C++, but
there aren't really any known C++ consumers of it- let's just cross
that bridge if we get there.
Reviewed by: kib, mckusick, rmacklem
Sponsored by: Klara, Inc.
(cherry picked from commit 84ce651836e0d037f611cd33a5c65e1d57049432)
---
sys/sys/extattr.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sys/sys/extattr.h b/sys/sys/extattr.h
index a16ef238656f..63c0d850599b 100644
--- a/sys/sys/extattr.h
+++ b/sys/sys/extattr.h
@@ -53,9 +53,9 @@
* char *extattr_namespace_names[] = EXTATTR_NAMESPACE_NAMES;
*/
#define EXTATTR_NAMESPACE_NAMES { \
- EXTATTR_NAMESPACE_EMPTY_STRING, \
- EXTATTR_NAMESPACE_USER_STRING, \
- EXTATTR_NAMESPACE_SYSTEM_STRING }
+ [EXTATTR_NAMESPACE_EMPTY] = EXTATTR_NAMESPACE_EMPTY_STRING, \
+ [EXTATTR_NAMESPACE_USER] = EXTATTR_NAMESPACE_USER_STRING, \
+ [EXTATTR_NAMESPACE_SYSTEM] = EXTATTR_NAMESPACE_SYSTEM_STRING }
#define EXTATTR_MAXNAMELEN NAME_MAX