Skip to contentSkip to conversation

selinux: use QSTR() instead of QSTR_INIT() in init_sel_fs

PATCH Applied Thorsten Blum 2 participants 2 messages Apr 22 – Apr 27 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux: use QSTR() instead of QSTR_INIT() in init_sel_fs

Drop the length argument and use the simpler QSTR().

---
 security/selinux/selinuxfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
security/selinux/selinuxfs.c +1 -2
index 83aa765a09f9..8c107af5140e 100644
@@ -2107,8 +2107,7 @@ struct path selinux_null __ro_after_init;
 
 int __init init_sel_fs(void)
 {
-	struct qstr null_name = QSTR_INIT(NULL_FILE_NAME,
-					  sizeof(NULL_FILE_NAME)-1);
+	struct qstr null_name = QSTR(NULL_FILE_NAME);
 	int err;
 
 	if (!selinux_enabled_boot)
maintainer Applied
#1 lore raw
Quoted 13 lines · On Apr 22, 2026 Thorsten Blum <[email protected]> wrote:

Drop the length argument and use the simpler QSTR().

---
 security/selinux/selinuxfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
security/selinux/selinuxfs.c +0 -0
index 83aa765a09f9..8c107af5140e 100644

security/selinux/selinuxfs.c struct path selinux_null __ro_after_init; · line 2113

Quoted 9 lines
security/selinux/selinuxfs.c +1 -2
@@ -2107,8 +2107,7 @@ struct path selinux_null __ro_after_init;
 
 int __init init_sel_fs(void)
 {
-	struct qstr null_name = QSTR_INIT(NULL_FILE_NAME,
-					  sizeof(NULL_FILE_NAME)-1);
+	struct qstr null_name = QSTR(NULL_FILE_NAME);
 	int err;
 
 	if (!selinux_enabled_boot)

Technically I imagine QSTR_INIT() would be slightly quicker since we use sizeof() instead of strlen(), but the code is simpler and I can't we only pay the performance hit once at boot.

Merged into selinux/dev, thanks.

--
paul-moore.com