Skip to content

Commit ea67677

Browse files
brooniepcmoore
authored andcommitted
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> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent ec4e9d6 commit ea67677

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/uapi/linux/lsm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef _UAPI_LINUX_LSM_H
1010
#define _UAPI_LINUX_LSM_H
1111

12+
#include <linux/stddef.h>
1213
#include <linux/types.h>
1314
#include <linux/unistd.h>
1415

@@ -36,7 +37,7 @@ struct lsm_ctx {
3637
__u64 flags;
3738
__u64 len;
3839
__u64 ctx_len;
39-
__u8 ctx[];
40+
__u8 ctx[] __counted_by(ctx_len);
4041
};
4142

4243
/*

0 commit comments

Comments
 (0)