Linux Hardening
 help / color / mirror / Atom feed
* [PATCH] string: Add missing const
@ 2026-11-25 18:26 Alejandro Colomar
  2026-11-26 15:20 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar @ 2026-11-25 18:26 UTC (permalink / raw)
  To: Kees Cook, linux-hardening; +Cc: Alejandro Colomar, Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 797 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

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

diff --git a/lib/tests/string_kunit.c b/lib/tests/string_kunit.c
index f84a60d4414c..2b681089c200 100644
--- a/lib/tests/string_kunit.c
+++ b/lib/tests/string_kunit.c
@@ -233,7 +233,7 @@ static void string_test_strnchr(struct kunit *test)
 {
 	const char *test_string = "abcdefghijkl";
 	const char *empty_string = "";
-	char *result;
+	const char *result;
 	int i, j;
 
 	for (i = 0; i < strlen(test_string) + 1; i++) {
-- 
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] string: Add missing const
  2026-11-25 18:26 [PATCH] string: Add missing const Alejandro Colomar
@ 2026-11-26 15:20 ` Andy Shevchenko
  2026-11-26 15:55   ` Alejandro Colomar
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2026-11-26 15:20 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: Kees Cook, linux-hardening, Andy Shevchenko

On Wed, Nov 25, 2026 at 07:26:38PM +0100, Alejandro Colomar wrote:
> This pointer is derived from other const pointers.

Constification almost always is a good thing, if this builds and works as
expected,

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] string: Add missing const
  2026-11-26 15:20 ` Andy Shevchenko
@ 2026-11-26 15:55   ` Alejandro Colomar
  0 siblings, 0 replies; 3+ messages in thread
From: Alejandro Colomar @ 2026-11-26 15:55 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Alejandro Colomar, Kees Cook, linux-hardening, Andy Shevchenko

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

Hi Andy,

> Date: 2026-11-26 17:20:11+0200
> From: Andy Shevchenko <andriy.shevchenko@intel.com>
>
> On Wed, Nov 25, 2026 at 07:26:38PM +0100, Alejandro Colomar wrote:
> > This pointer is derived from other const pointers.
> 
> Constification almost always is a good thing, if this builds and works as
> expected,

Yup, I built it as part of a larger branch.  I didn't run the tests,
but this should be a compile-time-only thing, so I don't think it's
necessary.

> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

Thanks!


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es>

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

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

end of thread, other threads:[~2026-11-26 15:55 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:26 [PATCH] string: Add missing const Alejandro Colomar
2026-11-26 15:20 ` Andy Shevchenko
2026-11-26 15:55   ` Alejandro Colomar

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