apparmorfs: Fine-tuning for three function implementations
Subsystems (3)
cover apparmorfs: Fine-tuning for three function implementations
From: Markus Elfring <[email protected]>
Date: Sun, 7 May 2017 13:58:08 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Combine two function calls into one in aa_fs_seq_raw_abi_show() Use seq_putc() in two functions
security/apparmor/apparmorfs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
Signature · 1 line
2.12.2
PATCH 1/2 apparmorfs: Combine two function calls into one in aa_fs_seq_raw_abi_show()
From: Markus Elfring <[email protected]>
Date: Sun, 7 May 2017 13:43:50 +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.
--- security/apparmor/apparmorfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
security/apparmor/apparmorfs.c +3 -4
@@ -572,10 +572,9 @@ static int aa_fs_seq_raw_abi_show(struct seq_file *seq, void *v)struct aa_proxy *proxy = seq->private;struct aa_profile *profile =aa_get_profile_rcu (&proxy->profile); -if (profile->rawdata->abi) { -seq_printf (seq,"v%d" , profile->rawdata->abi); -seq_puts (seq,"\n" ); - } +if (profile->rawdata->abi) +seq_printf (seq,"v%d\n" , profile->rawdata->abi); +aa_put_profile (profile);return 0 ;
Signature · 1 line
2.12.2
PATCH 2/2 apparmorfs: Use seq_putc() in two functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sun, 7 May 2017 13:50:28 +0200
Two single characters (line breaks) should be put into a sequence. Thus use the corresponding function "seq_putc".
This issue was detected by using the Coccinelle software.
--- security/apparmor/apparmorfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/apparmor/apparmorfs.c +2 -2
@@ -494,7 +494,7 @@ static int aa_fs_seq_hash_show(struct seq_file *seq, void *v)if (profile->hash) {for (i =0 ; i < size; i++)seq_printf (seq,"%.2x" , profile->hash[i]); -seq_puts (seq,"\n" ); +seq_putc (seq,'\n' ); }aa_put_profile (profile);
@@ -602,7 +602,7 @@ static int aa_fs_seq_raw_hash_show(struct seq_file *seq, void *v)if (profile->rawdata->hash) {for (i =0 ; i < size; i++)seq_printf (seq,"%.2x" , profile->rawdata->hash[i]); -seq_puts (seq,"\n" ); +seq_putc (seq,'\n' ); }aa_put_profile (profile);
Signature · 1 line
2.12.2
Re: [PATCH 1/2] apparmorfs: Combine two function calls into one in aa_fs_seq_raw_abi_show()
In reply to SF Markus ElfringQuoted 7 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sun, 7 May 2017 13:43:50 +0200A bit of data was put into a sequence by two separate function calls. Print the same data by a single function call instead.
Signed-off-by Markus Elfring <[email protected]>
I'll pull it into my tree for my next push
Quoted 23 lines
--- security/apparmor/apparmorfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)security/apparmor/apparmorfs.c +3
-4@@ -572,10 +572,9 @@ static int aa_fs_seq_raw_abi_show(struct seq_file *seq, void *v)struct aa_proxy *proxy = seq->private;struct aa_profile *profile =aa_get_profile_rcu (&proxy->profile); -if (profile->rawdata->abi) { -seq_printf (seq,"v%d" , profile->rawdata->abi); -seq_puts (seq,"\n" ); - } +if (profile->rawdata->abi) +seq_printf (seq,"v%d\n" , profile->rawdata->abi); +aa_put_profile (profile);return 0 ;
Re: [PATCH 2/2] apparmorfs: Use seq_putc() in two functions
In reply to SF Markus ElfringQuoted 9 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sun, 7 May 2017 13:50:28 +0200Two single characters (line breaks) 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 <[email protected]>
I'll pull it into my tree for my next push
Quoted 27 lines
--- security/apparmor/apparmorfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)security/apparmor/apparmorfs.c +2
-2@@ -494,7 +494,7 @@ static int aa_fs_seq_hash_show(struct seq_file *seq, void *v)if (profile->hash) {for (i =0 ; i < size; i++)seq_printf (seq,"%.2x" , profile->hash[i]); -seq_puts (seq,"\n" ); +seq_putc (seq,'\n' ); }aa_put_profile (profile);@@ -602,7 +602,7 @@ static int aa_fs_seq_raw_hash_show(struct seq_file *seq, void *v)if (profile->rawdata->hash) {for (i =0 ; i < size; i++)seq_printf (seq,"%.2x" , profile->rawdata->hash[i]); -seq_puts (seq,"\n" ); +seq_putc (seq,'\n' ); }aa_put_profile (profile);