From: zhaojiele <unclexiaole@gmail.com>
To: keescook@chromium.org, jmorris@namei.org, serge@hallyn.com
Cc: linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, zhaojiele <unclexiaole@gmail.com>
Subject: [PATCH] security/loadpin: Replace "kernel_read_file_str[j]" with function "kernel_read_file_id_str(j)".
Date: Thu, 4 Mar 2021 08:36:38 +0000 [thread overview]
Message-ID: <20210304083638.174767-1-unclexiaole@gmail.com> (raw)
Actually Linux kernel already provide function "kernel_read_file_id_str()"
for secure access in "kernel_read_file.h".And, in "parse_exclude()"
function, there is no need for
"BUILD_BUG_ON(ARRAY_SIZE(kernel_read_file_str) <
ARRAY_SIZE(ignore_read_file_id))"
when access array by functon "kernel_read_file_id_str(j)".
Signed-off-by: zhaojiele <unclexiaole@gmail.com>
---
security/loadpin/loadpin.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c
index b12f7d986b1e..3e8bdcd06600 100644
--- a/security/loadpin/loadpin.c
+++ b/security/loadpin/loadpin.c
@@ -210,8 +210,6 @@ static void __init parse_exclude(void)
*/
BUILD_BUG_ON(ARRAY_SIZE(exclude_read_files) !=
ARRAY_SIZE(ignore_read_file_id));
- BUILD_BUG_ON(ARRAY_SIZE(kernel_read_file_str) <
- ARRAY_SIZE(ignore_read_file_id));
for (i = 0; i < ARRAY_SIZE(exclude_read_files); i++) {
cur = exclude_read_files[i];
@@ -221,9 +219,9 @@ static void __init parse_exclude(void)
continue;
for (j = 0; j < ARRAY_SIZE(ignore_read_file_id); j++) {
- if (strcmp(cur, kernel_read_file_str[j]) == 0) {
+ if (strcmp(cur, kernel_read_file_id_str(j)) == 0) {
pr_info("excluding: %s\n",
- kernel_read_file_str[j]);
+ kernel_read_file_id_str(j));
ignore_read_file_id[j] = 1;
/*
* Can not break, because one read_file_str
--
2.25.1
next reply other threads:[~2021-03-04 8:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 8:36 zhaojiele [this message]
2021-03-04 23:50 ` [PATCH] security/loadpin: Replace "kernel_read_file_str[j]" with function "kernel_read_file_id_str(j)" Kees Cook
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=20210304083638.174767-1-unclexiaole@gmail.com \
--to=unclexiaole@gmail.com \
--cc=jmorris@namei.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).