Skip to contentSkip to conversation

NFSD: Using type of uint32_t for ex_nflavors instead of int

PATCH In review Kinglong Mee 2 participants 2 messages May 24, 2014 – May 27, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFSD: Using type of uint32_t for ex_nflavors instead of int

ex_nflavors can't be negative number, just defined by uint32_t.

---
 fs/nfsd/export.c | 7 ++++---
 fs/nfsd/export.h | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)
fs/nfsd/export.c +4 -3
index 8513c59..9343ae2 100644
@@ -437,13 +437,14 @@ out_free_all:
 
 static int secinfo_parse(char **mesg, char *buf, struct svc_export *exp)
 {
-	int listsize, err;
 	struct exp_flavor_info *f;
+	u32 listsize;
+	int err;
 
-	err = get_int(mesg, &listsize);
+	err = get_uint(mesg, &listsize);
 	if (err)
 		return err;
-	if (listsize < 0 || listsize > MAX_SECINFO_LIST)
+	if (listsize > MAX_SECINFO_LIST)
 		return -EINVAL;
 
 	for (f = exp->ex_flavors; f < exp->ex_flavors + listsize; f++) {
fs/nfsd/export.h +1 -1
index d7939a6..11d03b9 100644
@@ -53,7 +53,7 @@ struct svc_export {
 	int			ex_fsid;
 	unsigned char *		ex_uuid; /* 16 byte fsid */
 	struct nfsd4_fs_locations ex_fslocs;
-	int			ex_nflavors;
+	uint32_t		ex_nflavors;
 	struct exp_flavor_info	ex_flavors[MAX_SECINFO_LIST];
 	struct cache_detail	*cd;
 };
Signature · 1 line
1.9.3
#1 lore raw
Quoted 1 line · Kinglong Mee

ex_nflavors can't be negative number, just defined by uint32_t.

OK, applying for 3.16.--b.

Quoted 45 lines
---
 fs/nfsd/export.c | 7 ++++---
 fs/nfsd/export.h | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)
fs/nfsd/export.c +4 -3
index 8513c59..9343ae2 100644
@@ -437,13 +437,14 @@ out_free_all:
 
 static int secinfo_parse(char **mesg, char *buf, struct svc_export *exp)
 {
-	int listsize, err;
 	struct exp_flavor_info *f;
+	u32 listsize;
+	int err;
 
-	err = get_int(mesg, &listsize);
+	err = get_uint(mesg, &listsize);
 	if (err)
 		return err;
-	if (listsize < 0 || listsize > MAX_SECINFO_LIST)
+	if (listsize > MAX_SECINFO_LIST)
 		return -EINVAL;
 
 	for (f = exp->ex_flavors; f < exp->ex_flavors + listsize; f++) {
fs/nfsd/export.h +1 -1
index d7939a6..11d03b9 100644
@@ -53,7 +53,7 @@ struct svc_export {
 	int			ex_fsid;
 	unsigned char *		ex_uuid; /* 16 byte fsid */
 	struct nfsd4_fs_locations ex_fslocs;
-	int			ex_nflavors;
+	uint32_t		ex_nflavors;
 	struct exp_flavor_info	ex_flavors[MAX_SECINFO_LIST];
 	struct cache_detail	*cd;
 };
Signature · 1 line
1.9.3