lkml.org 
[lkml]   [2023]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] lsm: Add a __counted_by() annotation to lsm_ctx.ctx
The ctx in struct lsm_ctx is an array of size ctx_len, tell the compiler
about this using __counted_by() where supported to improve the ability to
detect overflow issues.

Reported-by: Aishwarya TCV <aishwarya.tcv@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
include/uapi/linux/lsm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/lsm.h b/include/uapi/linux/lsm.h
index f0386880a78e..4150333d224f 100644
--- a/include/uapi/linux/lsm.h
+++ b/include/uapi/linux/lsm.h
@@ -36,7 +36,7 @@ struct lsm_ctx {
__u64 flags;
__u64 len;
__u64 ctx_len;
- __u8 ctx[];
+ __u8 ctx[] __counted_by(ctx_len);
};

/*
---
base-commit: ec4e9d630a64df500641892f4e259e8149594a99
change-id: 20231221-lsm-fix-counted-by-f9fd827e26aa
Best regards,
--
Mark Brown <broonie@kernel.org>


\
 
 \ /
  Last update: 2023-12-21 21:39    [W:0.017 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site