mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xen: constify xsd_errors array
@ 2026-05-23 14:08 Len Bao
  2026-05-23 15:32 ` Juergen Gross
  0 siblings, 1 reply; 2+ messages in thread
From: Len Bao @ 2026-05-23 14:08 UTC (permalink / raw)
  To: Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko
  Cc: Len Bao, xen-devel, linux-kernel

The 'xsd_errors' array is initialized in the declaration and never
changed. So, constify it to reduce the attack surface.

At the same time, use the preferred '__maybe_unused' form over the
'__attribute__((unused))' form.

Signed-off-by: Len Bao <len.bao@gmx.us>
---
 include/xen/interface/io/xs_wire.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h
index b62365478..29d0394b8 100644
--- a/include/xen/interface/io/xs_wire.h
+++ b/include/xen/interface/io/xs_wire.h
@@ -51,7 +51,7 @@ struct xsd_errors
     const char *errstring;
 };
 #define XSD_ERROR(x) { x, #x }
-static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
+static const struct xsd_errors xsd_errors[] __maybe_unused = {
     XSD_ERROR(EINVAL),
     XSD_ERROR(EACCES),
     XSD_ERROR(EEXIST),
-- 
2.43.0


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

* Re: [PATCH] xen: constify xsd_errors array
  2026-05-23 14:08 [PATCH] xen: constify xsd_errors array Len Bao
@ 2026-05-23 15:32 ` Juergen Gross
  0 siblings, 0 replies; 2+ messages in thread
From: Juergen Gross @ 2026-05-23 15:32 UTC (permalink / raw)
  To: Len Bao, Stefano Stabellini, Oleksandr Tyshchenko; +Cc: xen-devel, linux-kernel


[-- Attachment #1.1.1: Type: text/plain, Size: 380 bytes --]

On 23.05.26 16:08, Len Bao wrote:
> The 'xsd_errors' array is initialized in the declaration and never
> changed. So, constify it to reduce the attack surface.
> 
> At the same time, use the preferred '__maybe_unused' form over the
> '__attribute__((unused))' form.
> 
> Signed-off-by: Len Bao <len.bao@gmx.us>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

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

end of thread, other threads:[~2026-05-23 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-23 14:08 [PATCH] xen: constify xsd_errors array Len Bao
2026-05-23 15:32 ` Juergen Gross

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

all inboxes | Powered by JetHome®