Linux Security Modules development
 help / color / mirror / Atom feed
* [PATCH] security: Add missing const
@ 2026-11-25 18:22 Alejandro Colomar
  2026-11-25 18:25 ` sashiko-bot
  2026-11-26  3:31 ` Guicai Ma
  0 siblings, 2 replies; 3+ messages in thread
From: Alejandro Colomar @ 2026-11-25 18:22 UTC (permalink / raw)
  To: Paul Moore, James Morris, Serge E. Hallyn, linux-security-module
  Cc: Alejandro Colomar

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

This pointer is derived from other const pointers.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
---

Hi,

This was found while changing some <linux/string.h> APIs to preserve the
const qualifier in the return type.


Have a lovely night!
Alex

 security/apparmor/lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c
index 73b88bde40bb..48c527170916 100644
--- a/security/apparmor/lib.c
+++ b/security/apparmor/lib.c
@@ -193,7 +193,7 @@ const char *aa_splitn_fqname(const char *fqname, size_t n, const char **ns_name,
 		return NULL;
 
 	if (name[0] == ':') {
-		char *split = strnchr(&name[1], end - &name[1], ':');
+		const char *split = strnchr(&name[1], end - &name[1], ':');
 		*ns_name = skipn_spaces(&name[1], end - &name[1]);
 		if (!*ns_name)
 			return NULL;
-- 
2.55.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] security: Add missing const
  2026-11-25 18:22 [PATCH] security: Add missing const Alejandro Colomar
@ 2026-11-25 18:25 ` sashiko-bot
  2026-11-26  3:31 ` Guicai Ma
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-25 18:25 UTC (permalink / raw)
  To: linux-security-module

> This pointer is derived from other const pointers.
> 
> Signed-off-by: Alejandro Colomar <alx@kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/41df4fcaea9d5eb41d07ffb4119621fb2f233b79.1795630921.git.alx@kernel.org?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] security: Add missing const
  2026-11-25 18:22 [PATCH] security: Add missing const Alejandro Colomar
  2026-11-25 18:25 ` sashiko-bot
@ 2026-11-26  3:31 ` Guicai Ma
  1 sibling, 0 replies; 3+ messages in thread
From: Guicai Ma @ 2026-11-26  3:31 UTC (permalink / raw)
  To: Alejandro Colomar
  Cc: Paul Moore, James Morris, Serge E. Hallyn, John Johansen,
	Georgia Garcia, apparmor, linux-security-module

The change is correct: after this point split is only read, through
pointer subtraction against *ns_name, split++, the strncmp() against
"//", and skipn_spaces(), which already takes a const char *.  strnchr()
returns a pointer derived from the const fqname, so the qualifier is
safe and behaviour is unchanged.

Built security/apparmor/lib.o with the patch applied (arm64, W=1): no
warnings.

One note on recipients: get_maintainer.pl also lists John Johansen,
Georgia Garcia and apparmor@lists.ubuntu.com for this file, so I have
added them here.  The posting only reached the LSM side.

Reviewed-by: Guicai Ma <maguicai@kylinos.cn>

Thanks,
Guicai Ma

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-26  3:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 18:22 [PATCH] security: Add missing const Alejandro Colomar
2026-11-25 18:25 ` sashiko-bot
2026-11-26  3:31 ` Guicai Ma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox