NFSD: Adjustments for six function implementations
Subsystems (3)
cover NFSD: Adjustments for six function implementations
From: Markus Elfring <[email protected]>
Date: Sat, 13 Jan 2018 15:00:15 +0100
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Use seq_putc() in four functions
Adjust four function calls together with a variable assignment
fs/nfsd/export.c | 19 ++++++++++++------- fs/nfsd/nfs4idmap.c | 4 ++-- 2 files changed, 14 insertions(+), 9 deletions(-)
Signature · 1 line
2.15.1
PATCH 1/2 nfsd: Use seq_putc() in four functions
From: Markus Elfring <[email protected]>
Date: Sat, 13 Jan 2018 14:20:27 +0100
Five single characters should be put into a sequence. Thus use the corresponding function "seq_putc".
This issue was detected by using the Coccinelle software.
--- fs/nfsd/export.c | 6 +++--- fs/nfsd/nfs4idmap.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
fs/nfsd/export.c +3 -3
@@ -181,10 +181,10 @@ static int expkey_show(struct seq_file *m,seq_printf (m,"%08x" , ek->ek_fsid[i]);if (test_bit (CACHE_VALID , &h->flags) && !test_bit (CACHE_NEGATIVE , &h->flags)) { -seq_printf (m," " ); +seq_putc (m,' ' );seq_path (m, &ek->ek_path,"\\ \t\n" ); } -seq_printf (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }
@@ -1123,7 +1123,7 @@ static void show_expflags(struct seq_file *m, int flags, int mask)static void show_secinfo_flags (struct seq_file *m,int flags) { -seq_printf (m,"," ); +seq_putc (m,',' );show_expflags (m, flags,NFSEXP_SECINFO_FLAGS ); }
fs/nfsd/nfs4idmap.c +2 -2
@@ -161,7 +161,7 @@ idtoname_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h) ent->id);if (test_bit (CACHE_VALID , &h->flags))seq_printf (m," %s" , ent->name); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }
@@ -332,7 +332,7 @@ nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h) ent->name);if (test_bit (CACHE_VALID , &h->flags))seq_printf (m," %u" , ent->id); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }
Signature · 1 line
2.15.1
PATCH 2/2 nfsd: Adjust four function calls together with a variable assignment
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 13 Jan 2018 14:40:44 +0100
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code places.
--- fs/nfsd/export.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
fs/nfsd/export.c +9 -4
@@ -90,7 +90,8 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) goto out; err = -EINVAL ; -if ((len=qword_get (&mesg, buf,PAGE_SIZE )) <=0 ) + len =qword_get (&mesg, buf,PAGE_SIZE ); +if (len <=0 ) goto out; err = -ENOENT ;
@@ -100,7 +101,8 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)dprintk ("found domain %s\n" , buf); err = -EINVAL ; -if ((len=qword_get (&mesg, buf,PAGE_SIZE )) <=0 ) + len =qword_get (&mesg, buf,PAGE_SIZE ); +if (len <=0 ) goto out; fsidtype =simple_strtoul (buf, &ep,10 );if (*ep)
@@ -108,7 +110,9 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)dprintk ("found fsidtype %d\n" , fsidtype);if (key_len (fsidtype)=0 )/* invalid type */ goto out; -if ((len=qword_get (&mesg, buf,PAGE_SIZE )) <=0 ) + + len =qword_get (&mesg, buf,PAGE_SIZE ); +if (len <=0 ) goto out;dprintk ("found fsid length %d\n" , len);if (len !=key_len (fsidtype))
@@ -538,7 +542,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)/* path */ err = -EINVAL ; -if ((len =qword_get (&mesg, buf,PAGE_SIZE )) <=0 ) + len =qword_get (&mesg, buf,PAGE_SIZE ); +if (len <=0 ) goto out1; err =kern_path (buf,0 , &exp.ex_path);
Signature · 1 line
2.15.1