* [PATCH 0/3] IMA: Fine-tuning for three function implementations @ 2017-05-07 13:40 SF Markus Elfring 2017-05-07 13:41 ` [PATCH 1/3] ima: Use seq_putc() in ima_ascii_measurements_show() SF Markus Elfring ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: SF Markus Elfring @ 2017-05-07 13:40 UTC (permalink / raw) To: linux-security-module From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 7 May 2017 15:35:15 +0200 A few update suggestions were taken into account from static source code analysis. Markus Elfring (3): Use seq_putc() in ima_ascii_measurements_show() Combine two function calls into one in ima_policy_show() Replace nine seq_puts() calls by seq_putc() security/integrity/ima/ima_fs.c | 4 ++-- security/integrity/ima/ima_policy.c | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) -- 2.12.2 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] ima: Use seq_putc() in ima_ascii_measurements_show() 2017-05-07 13:40 [PATCH 0/3] IMA: Fine-tuning for three function implementations SF Markus Elfring @ 2017-05-07 13:41 ` SF Markus Elfring 2017-05-07 13:42 ` [PATCH 2/3] ima: Combine two function calls into one in ima_policy_show() SF Markus Elfring ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: SF Markus Elfring @ 2017-05-07 13:41 UTC (permalink / raw) To: linux-security-module From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 7 May 2017 14:45:01 +0200 Two single characters should be put into a sequence. Thus use the corresponding function "seq_putc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- security/integrity/ima/ima_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c index ca303e5d2b94..732b5cd27042 100644 --- a/security/integrity/ima/ima_fs.c +++ b/security/integrity/ima/ima_fs.c @@ -242,14 +242,14 @@ static int ima_ascii_measurements_show(struct seq_file *m, void *v) /* 4th: template specific data */ for (i = 0; i < e->template_desc->num_fields; i++) { - seq_puts(m, " "); + seq_putc(m, ' '); if (e->template_data[i].len == 0) continue; e->template_desc->fields[i]->field_show(m, IMA_SHOW_ASCII, &e->template_data[i]); } - seq_puts(m, "\n"); + seq_putc(m, '\n'); return 0; } -- 2.12.2 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] ima: Combine two function calls into one in ima_policy_show() 2017-05-07 13:40 [PATCH 0/3] IMA: Fine-tuning for three function implementations SF Markus Elfring 2017-05-07 13:41 ` [PATCH 1/3] ima: Use seq_putc() in ima_ascii_measurements_show() SF Markus Elfring @ 2017-05-07 13:42 ` SF Markus Elfring 2017-05-07 13:43 ` [PATCH 3/3] ima: Replace nine seq_puts() calls by seq_putc() SF Markus Elfring 2017-05-08 14:26 ` [PATCH 0/3] IMA: Fine-tuning for three function implementations Mimi Zohar 3 siblings, 0 replies; 6+ messages in thread From: SF Markus Elfring @ 2017-05-07 13:42 UTC (permalink / raw) To: linux-security-module From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 7 May 2017 14:58:55 +0200 A bit of data was put into a sequence by two separate function calls. Print the same data by a single function call instead. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- security/integrity/ima/ima_policy.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index 3ab1067db624..83446a383ace 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -1086,10 +1086,8 @@ int ima_policy_show(struct seq_file *m, void *v) seq_puts(m, " "); } - if (entry->flags & IMA_FSUUID) { - seq_printf(m, "fsuuid=%pU", entry->fsuuid); - seq_puts(m, " "); - } + if (entry->flags & IMA_FSUUID) + seq_printf(m, "fsuuid=%pU ", entry->fsuuid); if (entry->flags & IMA_UID) { snprintf(tbuf, sizeof(tbuf), "%d", __kuid_val(entry->uid)); -- 2.12.2 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] ima: Replace nine seq_puts() calls by seq_putc() 2017-05-07 13:40 [PATCH 0/3] IMA: Fine-tuning for three function implementations SF Markus Elfring 2017-05-07 13:41 ` [PATCH 1/3] ima: Use seq_putc() in ima_ascii_measurements_show() SF Markus Elfring 2017-05-07 13:42 ` [PATCH 2/3] ima: Combine two function calls into one in ima_policy_show() SF Markus Elfring @ 2017-05-07 13:43 ` SF Markus Elfring 2017-05-08 14:26 ` [PATCH 0/3] IMA: Fine-tuning for three function implementations Mimi Zohar 3 siblings, 0 replies; 6+ messages in thread From: SF Markus Elfring @ 2017-05-07 13:43 UTC (permalink / raw) To: linux-security-module From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 7 May 2017 15:23:44 +0200 Nine single characters should be put into a sequence. Thus use the corresponding function "seq_putc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- security/integrity/ima/ima_policy.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index 83446a383ace..b1ec6f2ce0ad 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -1035,7 +1035,7 @@ static void policy_func_show(struct seq_file *m, enum ima_hooks func) seq_printf(m, pt(Opt_func), tbuf); break; } - seq_puts(m, " "); + seq_putc(m, ' '); } int ima_policy_show(struct seq_file *m, void *v) @@ -1057,7 +1057,7 @@ int ima_policy_show(struct seq_file *m, void *v) if (entry->action & AUDIT) seq_puts(m, pt(Opt_audit)); - seq_puts(m, " "); + seq_putc(m, ' '); if (entry->flags & IMA_FUNC) policy_func_show(m, entry->func); @@ -1071,19 +1071,19 @@ int ima_policy_show(struct seq_file *m, void *v) seq_printf(m, pt(Opt_mask), mt(mask_read)); if (entry->mask & MAY_APPEND) seq_printf(m, pt(Opt_mask), mt(mask_append)); - seq_puts(m, " "); + seq_putc(m, ' '); } if (entry->flags & IMA_FSMAGIC) { snprintf(tbuf, sizeof(tbuf), "0x%lx", entry->fsmagic); seq_printf(m, pt(Opt_fsmagic), tbuf); - seq_puts(m, " "); + seq_putc(m, ' '); } if (entry->flags & IMA_PCR) { snprintf(tbuf, sizeof(tbuf), "%d", entry->pcr); seq_printf(m, pt(Opt_pcr), tbuf); - seq_puts(m, " "); + seq_putc(m, ' '); } if (entry->flags & IMA_FSUUID) @@ -1097,7 +1097,7 @@ int ima_policy_show(struct seq_file *m, void *v) seq_printf(m, pt(Opt_uid_lt), tbuf); else seq_printf(m, pt(Opt_uid_eq), tbuf); - seq_puts(m, " "); + seq_putc(m, ' '); } if (entry->flags & IMA_EUID) { @@ -1108,7 +1108,7 @@ int ima_policy_show(struct seq_file *m, void *v) seq_printf(m, pt(Opt_euid_lt), tbuf); else seq_printf(m, pt(Opt_euid_eq), tbuf); - seq_puts(m, " "); + seq_putc(m, ' '); } if (entry->flags & IMA_FOWNER) { @@ -1119,7 +1119,7 @@ int ima_policy_show(struct seq_file *m, void *v) seq_printf(m, pt(Opt_fowner_lt), tbuf); else seq_printf(m, pt(Opt_fowner_eq), tbuf); - seq_puts(m, " "); + seq_putc(m, ' '); } for (i = 0; i < MAX_LSM_RULES; i++) { @@ -1157,7 +1157,7 @@ int ima_policy_show(struct seq_file *m, void *v) if (entry->flags & IMA_PERMIT_DIRECTIO) seq_puts(m, "permit_directio "); rcu_read_unlock(); - seq_puts(m, "\n"); + seq_putc(m, '\n'); return 0; } #endif /* CONFIG_IMA_READ_POLICY */ -- 2.12.2 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 0/3] IMA: Fine-tuning for three function implementations 2017-05-07 13:40 [PATCH 0/3] IMA: Fine-tuning for three function implementations SF Markus Elfring ` (2 preceding siblings ...) 2017-05-07 13:43 ` [PATCH 3/3] ima: Replace nine seq_puts() calls by seq_putc() SF Markus Elfring @ 2017-05-08 14:26 ` Mimi Zohar 2017-05-08 15:26 ` SF Markus Elfring 3 siblings, 1 reply; 6+ messages in thread From: Mimi Zohar @ 2017-05-08 14:26 UTC (permalink / raw) To: linux-security-module Hi Markus, On Sun, 2017-05-07 at 15:40 +0200, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sun, 7 May 2017 15:35:15 +0200 > > A few update suggestions were taken into account > from static source code analysis. Sorry, these changes make backporting and upstreaming other changes more difficult without much benefit. Mimi -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* IMA: Fine-tuning for three function implementations 2017-05-08 14:26 ` [PATCH 0/3] IMA: Fine-tuning for three function implementations Mimi Zohar @ 2017-05-08 15:26 ` SF Markus Elfring 0 siblings, 0 replies; 6+ messages in thread From: SF Markus Elfring @ 2017-05-08 15:26 UTC (permalink / raw) To: linux-security-module > Sorry, these changes make backporting and upstreaming other changes > more difficult without much benefit. I guess that they show general development challenges for further software evolution as usual. Would it be nice to achieve a bit more code reduction and improved run time characteristics also for the affected logging functions? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-08 15:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-07 13:40 [PATCH 0/3] IMA: Fine-tuning for three function implementations SF Markus Elfring 2017-05-07 13:41 ` [PATCH 1/3] ima: Use seq_putc() in ima_ascii_measurements_show() SF Markus Elfring 2017-05-07 13:42 ` [PATCH 2/3] ima: Combine two function calls into one in ima_policy_show() SF Markus Elfring 2017-05-07 13:43 ` [PATCH 3/3] ima: Replace nine seq_puts() calls by seq_putc() SF Markus Elfring 2017-05-08 14:26 ` [PATCH 0/3] IMA: Fine-tuning for three function implementations Mimi Zohar 2017-05-08 15:26 ` SF Markus Elfring
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).