* [PATCH 0/2] Simplify the implementation of some functions in IMA @ 2020-04-14 11:48 Tianjia Zhang 2020-04-14 11:48 ` [PATCH 1/2] ima: simplify function ima_store_template Tianjia Zhang 2020-04-14 11:48 ` [PATCH 2/2] ima: simplify function process_buffer_measurement Tianjia Zhang 0 siblings, 2 replies; 5+ messages in thread From: Tianjia Zhang @ 2020-04-14 11:48 UTC (permalink / raw) To: zohar, dmitry.kasatkin, jmorris, serge, zhangliguang, zhang.jia Cc: linux-integrity, linux-security-module, linux-kernel, tianjia.zhang Simplify the implementation of some functions in IMA. Tianjia Zhang (2): ima: simplify function ima_store_template ima: simplify function process_buffer_measurement security/integrity/ima/ima_api.c | 3 +-- security/integrity/ima/ima_main.c | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ima: simplify function ima_store_template 2020-04-14 11:48 [PATCH 0/2] Simplify the implementation of some functions in IMA Tianjia Zhang @ 2020-04-14 11:48 ` Tianjia Zhang 2020-04-14 15:17 ` Lakshmi Ramasubramanian 2020-04-14 11:48 ` [PATCH 2/2] ima: simplify function process_buffer_measurement Tianjia Zhang 1 sibling, 1 reply; 5+ messages in thread From: Tianjia Zhang @ 2020-04-14 11:48 UTC (permalink / raw) To: zohar, dmitry.kasatkin, jmorris, serge, zhangliguang, zhang.jia Cc: linux-integrity, linux-security-module, linux-kernel, tianjia.zhang The 'result' here is not necessary, remove redundant code, the code is more concise. Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> --- security/integrity/ima/ima_api.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c index f6bc00914aa5..9121257c9dc6 100644 --- a/security/integrity/ima/ima_api.c +++ b/security/integrity/ima/ima_api.c @@ -118,8 +118,7 @@ int ima_store_template(struct ima_template_entry *entry, memcpy(entry->digest, hash.hdr.digest, hash.hdr.length); } entry->pcr = pcr; - result = ima_add_template_entry(entry, violation, op, inode, filename); - return result; + return ima_add_template_entry(entry, violation, op, inode, filename); } /* -- 2.17.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ima: simplify function ima_store_template 2020-04-14 11:48 ` [PATCH 1/2] ima: simplify function ima_store_template Tianjia Zhang @ 2020-04-14 15:17 ` Lakshmi Ramasubramanian 0 siblings, 0 replies; 5+ messages in thread From: Lakshmi Ramasubramanian @ 2020-04-14 15:17 UTC (permalink / raw) To: Tianjia Zhang, zohar, dmitry.kasatkin, jmorris, serge, zhangliguang, zhang.jia Cc: linux-integrity, linux-security-module, linux-kernel On 4/14/20 4:48 AM, Tianjia Zhang wrote: > The 'result' here is not necessary, remove redundant code, > the code is more concise. > > Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> > --- > security/integrity/ima/ima_api.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c > index f6bc00914aa5..9121257c9dc6 100644 > --- a/security/integrity/ima/ima_api.c > +++ b/security/integrity/ima/ima_api.c > @@ -118,8 +118,7 @@ int ima_store_template(struct ima_template_entry *entry, > memcpy(entry->digest, hash.hdr.digest, hash.hdr.length); > } > entry->pcr = pcr; > - result = ima_add_template_entry(entry, violation, op, inode, filename); > - return result; > + return ima_add_template_entry(entry, violation, op, inode, filename); > } > > /* > Reviewed-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] ima: simplify function process_buffer_measurement 2020-04-14 11:48 [PATCH 0/2] Simplify the implementation of some functions in IMA Tianjia Zhang 2020-04-14 11:48 ` [PATCH 1/2] ima: simplify function ima_store_template Tianjia Zhang @ 2020-04-14 11:48 ` Tianjia Zhang 2020-04-14 15:18 ` Lakshmi Ramasubramanian 1 sibling, 1 reply; 5+ messages in thread From: Tianjia Zhang @ 2020-04-14 11:48 UTC (permalink / raw) To: zohar, dmitry.kasatkin, jmorris, serge, zhangliguang, zhang.jia Cc: linux-integrity, linux-security-module, linux-kernel, tianjia.zhang Remove duplicate judgment code to make it more suitable for linux code style. Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> --- security/integrity/ima/ima_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 9d0abedeae77..55cbbe97ce6e 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c @@ -750,15 +750,15 @@ void process_buffer_measurement(const void *buf, int size, goto out; ret = ima_store_template(entry, violation, NULL, buf, pcr); - - if (ret < 0) - ima_free_template_entry(entry); - -out: if (ret < 0) - pr_devel("%s: failed, result: %d\n", __func__, ret); + goto out_free_entry; return; + +out_free_entry: + ima_free_template_entry(entry); +out: + pr_devel("%s: failed, result: %d\n", __func__, ret); } /** -- 2.17.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ima: simplify function process_buffer_measurement 2020-04-14 11:48 ` [PATCH 2/2] ima: simplify function process_buffer_measurement Tianjia Zhang @ 2020-04-14 15:18 ` Lakshmi Ramasubramanian 0 siblings, 0 replies; 5+ messages in thread From: Lakshmi Ramasubramanian @ 2020-04-14 15:18 UTC (permalink / raw) To: Tianjia Zhang, zohar, dmitry.kasatkin, jmorris, serge, zhangliguang, zhang.jia Cc: linux-integrity, linux-security-module, linux-kernel On 4/14/20 4:48 AM, Tianjia Zhang wrote: > Remove duplicate judgment code to make it more suitable for linux > code style. > > Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> > --- > security/integrity/ima/ima_main.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c > index 9d0abedeae77..55cbbe97ce6e 100644 > --- a/security/integrity/ima/ima_main.c > +++ b/security/integrity/ima/ima_main.c > @@ -750,15 +750,15 @@ void process_buffer_measurement(const void *buf, int size, > goto out; > > ret = ima_store_template(entry, violation, NULL, buf, pcr); > - > - if (ret < 0) > - ima_free_template_entry(entry); > - > -out: > if (ret < 0) > - pr_devel("%s: failed, result: %d\n", __func__, ret); > + goto out_free_entry; > > return; > + > +out_free_entry: > + ima_free_template_entry(entry); > +out: > + pr_devel("%s: failed, result: %d\n", __func__, ret); > } Reviewed-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-14 15:18 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-04-14 11:48 [PATCH 0/2] Simplify the implementation of some functions in IMA Tianjia Zhang 2020-04-14 11:48 ` [PATCH 1/2] ima: simplify function ima_store_template Tianjia Zhang 2020-04-14 15:17 ` Lakshmi Ramasubramanian 2020-04-14 11:48 ` [PATCH 2/2] ima: simplify function process_buffer_measurement Tianjia Zhang 2020-04-14 15:18 ` Lakshmi Ramasubramanian
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).