From: Lu Yao <yaolu@kylinos.cn>
To: paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com
Cc: linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, Lu Yao <yaolu@kylinos.cn>
Subject: [PATCH] lsm: Resolve compiling 'security.c' error
Date: Wed, 17 Jan 2024 09:45:41 +0800 [thread overview]
Message-ID: <20240117014541.8887-1-yaolu@kylinos.cn> (raw)
The following error log is displayed during the current compilation
> 'security/security.c:810:2: error: ‘memcpy’ offset 32 is
> out of the bounds [0, 0] [-Werror=array-bounds]'
GCC version is '10.3.0 (Ubuntu 10.3.0-1ubuntu1~18.04~1)'
Signed-off-by: Lu Yao <yaolu@kylinos.cn>
---
security/security.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/security.c b/security/security.c
index 0144a98d3712..37168f6bee25 100644
--- a/security/security.c
+++ b/security/security.c
@@ -792,7 +792,7 @@ int lsm_fill_user_ctx(struct lsm_ctx __user *uctx, size_t *uctx_len,
size_t nctx_len;
int rc = 0;
- nctx_len = ALIGN(struct_size(nctx, ctx, val_len), sizeof(void *));
+ nctx_len = ALIGN(sizeof(struct lsm_ctx) + val_len, sizeof(void *));
if (nctx_len > *uctx_len) {
rc = -E2BIG;
goto out;
--
2.25.1
next reply other threads:[~2024-01-17 1:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 1:45 Lu Yao [this message]
2024-01-17 14:32 ` [PATCH] lsm: Resolve compiling 'security.c' error Paul Moore
2024-01-17 20:51 ` Kees Cook
2024-01-17 22:03 ` Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240117014541.8887-1-yaolu@kylinos.cn \
--to=yaolu@kylinos.cn \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox