[PATCH 1/3] fs/9p: remove obsolete simple_strto

2013-01-18 Thread Abhijit Pawar
This patch replace the obsolete simple_strto with kstrto.

Signed-off-by: Abhijit Pawar 
---
 fs/9p/v9fs.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index d934f04..6ac48fc 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -112,7 +112,7 @@ static int v9fs_parse_options(struct v9fs_session_info 
*v9ses, char *opts)
substring_t args[MAX_OPT_ARGS];
char *p;
int option = 0;
-   char *s, *e;
+   char *s;
int ret = 0;
 
/* setup defaults */
@@ -249,9 +249,8 @@ static int v9fs_parse_options(struct v9fs_session_info 
*v9ses, char *opts)
v9ses->flags |= V9FS_ACCESS_CLIENT;
} else {
v9ses->flags |= V9FS_ACCESS_SINGLE;
-   v9ses->uid = simple_strtoul(s, , 10);
-   if (*e != '\0') {
-   ret = -EINVAL;
+   ret = kstrtouint(s, 10, >uid);
+   if (ret) {
pr_info("Unknown access argument %s\n",
s);
kfree(s);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] fs/9p: remove obsolete simple_strtofoo

2013-01-18 Thread Abhijit Pawar
This patch replace the obsolete simple_strtofoo with kstrtofoo.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/9p/v9fs.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index d934f04..6ac48fc 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -112,7 +112,7 @@ static int v9fs_parse_options(struct v9fs_session_info 
*v9ses, char *opts)
substring_t args[MAX_OPT_ARGS];
char *p;
int option = 0;
-   char *s, *e;
+   char *s;
int ret = 0;
 
/* setup defaults */
@@ -249,9 +249,8 @@ static int v9fs_parse_options(struct v9fs_session_info 
*v9ses, char *opts)
v9ses-flags |= V9FS_ACCESS_CLIENT;
} else {
v9ses-flags |= V9FS_ACCESS_SINGLE;
-   v9ses-uid = simple_strtoul(s, e, 10);
-   if (*e != '\0') {
-   ret = -EINVAL;
+   ret = kstrtouint(s, 10, v9ses-uid);
+   if (ret) {
pr_info(Unknown access argument %s\n,
s);
kfree(s);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] fs/xfs remove obsolete simple_strto

2013-01-10 Thread Abhijit Pawar
On 01/11/2013 12:06 PM, Jeff Liu wrote:
> On 01/09/2013 10:04 PM, Abhijit Pawar wrote:
>> This patch replaces usages of obsolete simple_strtoul with kstrtoint in 
>> xfs_args and suffix_strtoul.
>>
>> Signed-off-by: Abhijit Pawar 
>> ---
>>  fs/xfs/xfs_super.c |   29 +++--
>>  1 files changed, 19 insertions(+), 10 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
>> index ab8839b..c407121 100644
>> --- a/fs/xfs/xfs_super.c
>> +++ b/fs/xfs/xfs_super.c
>> @@ -139,9 +139,9 @@ static const match_table_t tokens = {
>>  
>>  
>>  STATIC unsigned long
>> -suffix_strtoul(char *s, char **endp, unsigned int base)
>> +suffix_kstrtoint(char *s, unsigned int base, int *res)
>>  {
>> -int last, shift_left_factor = 0;
>> +int last, shift_left_factor = 0, _res;
>>  char*value = s;
>>  
>>  last = strlen(value) - 1;
>> @@ -158,7 +158,10 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
>>  value[last] = '\0';
>>  }
>>  
>> -return simple_strtoul((const char *)s, endp, base) << shift_left_factor;
>> +if (kstrtoint(s, base, &_res))
>> +return -EINVAL;
>> +*res = _res << shift_left_factor;
>> +return 0;
>>  }
>>  
>>  /*
>> @@ -174,7 +177,7 @@ xfs_parseargs(
>>  char*options)
>>  {
>>  struct super_block  *sb = mp->m_super;
>> -char*this_char, *value, *eov;
>> +char*this_char, *value;
>>  int dsunit = 0;
>>  int dswidth = 0;
>>  int iosize = 0;
>> @@ -230,14 +233,16 @@ xfs_parseargs(
>>  this_char);
>>  return EINVAL;
>>  }
>> -mp->m_logbufs = simple_strtoul(value, , 10);
>> +if (kstrtoint(value, 10, >m_logbufs))
>> +return EINVAL;
>>  } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
>>  if (!value || !*value) {
>>  xfs_warn(mp, "%s option requires an argument",
>>  this_char);
>>  return EINVAL;
>>  }
>> -mp->m_logbsize = suffix_strtoul(value, , 10);
>> +if (suffix_kstrtoint(value, 10, >m_logbsize))
>> +return EINVAL;
>>  } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
>>  if (!value || !*value) {
>>  xfs_warn(mp, "%s option requires an argument",
>> @@ -266,7 +271,8 @@ xfs_parseargs(
>>  this_char);
>>  return EINVAL;
>>  }
>> -iosize = simple_strtoul(value, , 10);
>> +if (kstrtoint(value, 10, ))
>> +return EINVAL;
>>  iosizelog = ffs(iosize) - 1;
>>  } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
>>  if (!value || !*value) {
>> @@ -274,7 +280,8 @@ xfs_parseargs(
>>  this_char);
>>  return EINVAL;
>>  }
>> -iosize = suffix_strtoul(value, , 10);
>> +if (suffix_kstrtoint(value, 10, ))
>> +return EINVAL;
>>  iosizelog = ffs(iosize) - 1;
>>  } else if (!strcmp(this_char, MNTOPT_GRPID) ||
>> !strcmp(this_char, MNTOPT_BSDGROUPS)) {
>> @@ -296,14 +303,16 @@ xfs_parseargs(
>>  this_char);
>>  return EINVAL;
>>  }
>> -dsunit = simple_strtoul(value, , 10);
>> +if (kstrtoint(value, 10, ))
>> +return EINVAL;
>>  } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
>>  if (!value || !*value) {
>>  xfs_warn(mp, "%s option requires an argument",
>>  this_char);
>>  return EINVAL;
>>  }
>> -  

Re: [PATCH 1/1] fs/xfs remove obsolete simple_strtofoo

2013-01-10 Thread Abhijit Pawar
On 01/11/2013 12:06 PM, Jeff Liu wrote:
 On 01/09/2013 10:04 PM, Abhijit Pawar wrote:
 This patch replaces usages of obsolete simple_strtoul with kstrtoint in 
 xfs_args and suffix_strtoul.

 Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
 ---
  fs/xfs/xfs_super.c |   29 +++--
  1 files changed, 19 insertions(+), 10 deletions(-)

 diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
 index ab8839b..c407121 100644
 --- a/fs/xfs/xfs_super.c
 +++ b/fs/xfs/xfs_super.c
 @@ -139,9 +139,9 @@ static const match_table_t tokens = {
  
  
  STATIC unsigned long
 -suffix_strtoul(char *s, char **endp, unsigned int base)
 +suffix_kstrtoint(char *s, unsigned int base, int *res)
  {
 -int last, shift_left_factor = 0;
 +int last, shift_left_factor = 0, _res;
  char*value = s;
  
  last = strlen(value) - 1;
 @@ -158,7 +158,10 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
  value[last] = '\0';
  }
  
 -return simple_strtoul((const char *)s, endp, base)  shift_left_factor;
 +if (kstrtoint(s, base, _res))
 +return -EINVAL;
 +*res = _res  shift_left_factor;
 +return 0;
  }
  
  /*
 @@ -174,7 +177,7 @@ xfs_parseargs(
  char*options)
  {
  struct super_block  *sb = mp-m_super;
 -char*this_char, *value, *eov;
 +char*this_char, *value;
  int dsunit = 0;
  int dswidth = 0;
  int iosize = 0;
 @@ -230,14 +233,16 @@ xfs_parseargs(
  this_char);
  return EINVAL;
  }
 -mp-m_logbufs = simple_strtoul(value, eov, 10);
 +if (kstrtoint(value, 10, mp-m_logbufs))
 +return EINVAL;
  } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
  if (!value || !*value) {
  xfs_warn(mp, %s option requires an argument,
  this_char);
  return EINVAL;
  }
 -mp-m_logbsize = suffix_strtoul(value, eov, 10);
 +if (suffix_kstrtoint(value, 10, mp-m_logbsize))
 +return EINVAL;
  } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
  if (!value || !*value) {
  xfs_warn(mp, %s option requires an argument,
 @@ -266,7 +271,8 @@ xfs_parseargs(
  this_char);
  return EINVAL;
  }
 -iosize = simple_strtoul(value, eov, 10);
 +if (kstrtoint(value, 10, iosize))
 +return EINVAL;
  iosizelog = ffs(iosize) - 1;
  } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
  if (!value || !*value) {
 @@ -274,7 +280,8 @@ xfs_parseargs(
  this_char);
  return EINVAL;
  }
 -iosize = suffix_strtoul(value, eov, 10);
 +if (suffix_kstrtoint(value, 10, iosize))
 +return EINVAL;
  iosizelog = ffs(iosize) - 1;
  } else if (!strcmp(this_char, MNTOPT_GRPID) ||
 !strcmp(this_char, MNTOPT_BSDGROUPS)) {
 @@ -296,14 +303,16 @@ xfs_parseargs(
  this_char);
  return EINVAL;
  }
 -dsunit = simple_strtoul(value, eov, 10);
 +if (kstrtoint(value, 10, dsunit))
 +return EINVAL;
  } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
  if (!value || !*value) {
  xfs_warn(mp, %s option requires an argument,
  this_char);
  return EINVAL;
  }
 -dswidth = simple_strtoul(value, eov, 10);
 +if (kstrtoint(value, 10, dswidth))
 +return EINVAL;
  } else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
  mp-m_flags |= XFS_MOUNT_SMALL_INUMS;
  } else if (!strcmp(this_char, MNTOPT_64BITINODE)) {

 checkpatch.pl show warning if we return EINVAL as below:
 WARNING: return of an errno should typically be -ve (return -EINVAL)
 
 Can we just ignore such code style issue?
I think we can.
Ben?
 
 Thanks,
 -Jeff
 


-- 
-
Abhijit
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] fs/xfs remove obsolete simple_strto

2013-01-09 Thread Abhijit Pawar
This patch replaces usages of obsolete simple_strtoul with kstrtoint in 
xfs_args and suffix_strtoul.

Signed-off-by: Abhijit Pawar 
---
 fs/xfs/xfs_super.c |   29 +++--
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index ab8839b..c407121 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -139,9 +139,9 @@ static const match_table_t tokens = {
 
 
 STATIC unsigned long
-suffix_strtoul(char *s, char **endp, unsigned int base)
+suffix_kstrtoint(char *s, unsigned int base, int *res)
 {
-   int last, shift_left_factor = 0;
+   int last, shift_left_factor = 0, _res;
char*value = s;
 
last = strlen(value) - 1;
@@ -158,7 +158,10 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
value[last] = '\0';
}
 
-   return simple_strtoul((const char *)s, endp, base) << shift_left_factor;
+   if (kstrtoint(s, base, &_res))
+   return -EINVAL;
+   *res = _res << shift_left_factor;
+   return 0;
 }
 
 /*
@@ -174,7 +177,7 @@ xfs_parseargs(
char*options)
 {
struct super_block  *sb = mp->m_super;
-   char*this_char, *value, *eov;
+   char*this_char, *value;
int dsunit = 0;
int dswidth = 0;
int iosize = 0;
@@ -230,14 +233,16 @@ xfs_parseargs(
this_char);
return EINVAL;
}
-   mp->m_logbufs = simple_strtoul(value, , 10);
+   if (kstrtoint(value, 10, >m_logbufs))
+   return EINVAL;
} else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
if (!value || !*value) {
xfs_warn(mp, "%s option requires an argument",
this_char);
return EINVAL;
}
-   mp->m_logbsize = suffix_strtoul(value, , 10);
+   if (suffix_kstrtoint(value, 10, >m_logbsize))
+   return EINVAL;
} else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
if (!value || !*value) {
xfs_warn(mp, "%s option requires an argument",
@@ -266,7 +271,8 @@ xfs_parseargs(
this_char);
return EINVAL;
}
-   iosize = simple_strtoul(value, , 10);
+   if (kstrtoint(value, 10, ))
+   return EINVAL;
iosizelog = ffs(iosize) - 1;
} else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
if (!value || !*value) {
@@ -274,7 +280,8 @@ xfs_parseargs(
this_char);
return EINVAL;
}
-   iosize = suffix_strtoul(value, , 10);
+   if (suffix_kstrtoint(value, 10, ))
+   return EINVAL;
iosizelog = ffs(iosize) - 1;
} else if (!strcmp(this_char, MNTOPT_GRPID) ||
   !strcmp(this_char, MNTOPT_BSDGROUPS)) {
@@ -296,14 +303,16 @@ xfs_parseargs(
this_char);
return EINVAL;
}
-   dsunit = simple_strtoul(value, , 10);
+   if (kstrtoint(value, 10, ))
+   return EINVAL;
} else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
if (!value || !*value) {
xfs_warn(mp, "%s option requires an argument",
this_char);
return EINVAL;
}
-   dswidth = simple_strtoul(value, , 10);
+   if (kstrtoint(value, 10, ))
+   return EINVAL;
} else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] fs/xfs remove obsolete simple_strtofoo

2013-01-09 Thread Abhijit Pawar
This patch replaces usages of obsolete simple_strtoul with kstrtoint in 
xfs_args and suffix_strtoul.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/xfs/xfs_super.c |   29 +++--
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index ab8839b..c407121 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -139,9 +139,9 @@ static const match_table_t tokens = {
 
 
 STATIC unsigned long
-suffix_strtoul(char *s, char **endp, unsigned int base)
+suffix_kstrtoint(char *s, unsigned int base, int *res)
 {
-   int last, shift_left_factor = 0;
+   int last, shift_left_factor = 0, _res;
char*value = s;
 
last = strlen(value) - 1;
@@ -158,7 +158,10 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
value[last] = '\0';
}
 
-   return simple_strtoul((const char *)s, endp, base)  shift_left_factor;
+   if (kstrtoint(s, base, _res))
+   return -EINVAL;
+   *res = _res  shift_left_factor;
+   return 0;
 }
 
 /*
@@ -174,7 +177,7 @@ xfs_parseargs(
char*options)
 {
struct super_block  *sb = mp-m_super;
-   char*this_char, *value, *eov;
+   char*this_char, *value;
int dsunit = 0;
int dswidth = 0;
int iosize = 0;
@@ -230,14 +233,16 @@ xfs_parseargs(
this_char);
return EINVAL;
}
-   mp-m_logbufs = simple_strtoul(value, eov, 10);
+   if (kstrtoint(value, 10, mp-m_logbufs))
+   return EINVAL;
} else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
if (!value || !*value) {
xfs_warn(mp, %s option requires an argument,
this_char);
return EINVAL;
}
-   mp-m_logbsize = suffix_strtoul(value, eov, 10);
+   if (suffix_kstrtoint(value, 10, mp-m_logbsize))
+   return EINVAL;
} else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
if (!value || !*value) {
xfs_warn(mp, %s option requires an argument,
@@ -266,7 +271,8 @@ xfs_parseargs(
this_char);
return EINVAL;
}
-   iosize = simple_strtoul(value, eov, 10);
+   if (kstrtoint(value, 10, iosize))
+   return EINVAL;
iosizelog = ffs(iosize) - 1;
} else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
if (!value || !*value) {
@@ -274,7 +280,8 @@ xfs_parseargs(
this_char);
return EINVAL;
}
-   iosize = suffix_strtoul(value, eov, 10);
+   if (suffix_kstrtoint(value, 10, iosize))
+   return EINVAL;
iosizelog = ffs(iosize) - 1;
} else if (!strcmp(this_char, MNTOPT_GRPID) ||
   !strcmp(this_char, MNTOPT_BSDGROUPS)) {
@@ -296,14 +303,16 @@ xfs_parseargs(
this_char);
return EINVAL;
}
-   dsunit = simple_strtoul(value, eov, 10);
+   if (kstrtoint(value, 10, dsunit))
+   return EINVAL;
} else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
if (!value || !*value) {
xfs_warn(mp, %s option requires an argument,
this_char);
return EINVAL;
}
-   dswidth = simple_strtoul(value, eov, 10);
+   if (kstrtoint(value, 10, dswidth))
+   return EINVAL;
} else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
mp-m_flags |= XFS_MOUNT_SMALL_INUMS;
} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] net: remove obsolete simple_strto

2012-12-10 Thread Abhijit Pawar
This patch removes the redundant occurences of simple_strto

Signed-off-by: Abhijit Pawar 
---
 net/core/netpoll.c|1 -
 net/mac80211/debugfs_sta.c|1 -
 net/netfilter/nf_conntrack_core.c |1 -
 3 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 12c129f..3151acf 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -706,7 +706,6 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
*delim = 0;
if (*cur == ' ' || *cur == '\t')
np_info(np, "warning: whitespace is not allowed\n");
-   np->remote_port = simple_strtol(cur, NULL, 10);
if (kstrtou16(cur, 10, >remote_port))
goto parse_failed;
cur = delim;
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 0dedb4b..6fb1168 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -220,7 +220,6 @@ static ssize_t sta_agg_status_write(struct file *file, 
const char __user *userbu
} else
return -EINVAL;
 
-   tid = simple_strtoul(buf, NULL, 0);
ret = kstrtoul(buf, 0, );
if (ret)
return ret;
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index 37d9e62..08cdc71 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1422,7 +1422,6 @@ int nf_conntrack_set_hashsize(const char *val, struct 
kernel_param *kp)
if (!nf_conntrack_htable_size)
return param_set_uint(val, kp);
 
-   hashsize = simple_strtoul(val, NULL, 0);
rc = kstrtouint(val, 0, );
if (rc)
return rc;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND RESEND] net: remove obsolete simple_strto

2012-12-10 Thread Abhijit Pawar
On 12/11/2012 10:19 AM, David Miller wrote:
> From: Abhijit Pawar 
> Date: Tue, 11 Dec 2012 09:04:20 +0530
> 
>> This patch replace the obsolete simple_strto with kstrto
>>
>> Signed-off-by: Abhijit Pawar 
> 
> You can't submit replacement patches for ones which I have already
> applied.
> 
> Patches I apply are permanently applied, and therefore you must submit
> changes relative the ones I've applied already.
> 
I am sorry to create this confusion. I have created and sent the new
patch which you can apply over the old one to fix the issues.

-- 
-
Abhijit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND RESEND] net: remove obsolete simple_strto

2012-12-10 Thread Abhijit Pawar
This patch replace the obsolete simple_strto with kstrto

Signed-off-by: Abhijit Pawar 
---
 net/core/netpoll.c |6 --
 net/ipv4/netfilter/ipt_CLUSTERIP.c |9 +++--
 net/mac80211/debugfs_sta.c |4 +++-
 net/netfilter/nf_conntrack_core.c  |6 --
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 77a0388..3151acf 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -674,7 +674,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed;
*delim = 0;
-   np->local_port = simple_strtol(cur, NULL, 10);
+   if (kstrtou16(cur, 10, >local_port))
+   goto parse_failed;
cur = delim;
}
cur++;
@@ -705,7 +706,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
*delim = 0;
if (*cur == ' ' || *cur == '\t')
np_info(np, "warning: whitespace is not allowed\n");
-   np->remote_port = simple_strtol(cur, NULL, 10);
+   if (kstrtou16(cur, 10, >remote_port))
+   goto parse_failed;
cur = delim;
}
cur++;
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c 
b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index fe5daea..75e33a7 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -661,6 +661,7 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
 #define PROC_WRITELEN  10
char buffer[PROC_WRITELEN+1];
unsigned long nodenum;
+   int rc;
 
if (size > PROC_WRITELEN)
return -EIO;
@@ -669,11 +670,15 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
buffer[size] = 0;
 
if (*buffer == '+') {
-   nodenum = simple_strtoul(buffer+1, NULL, 10);
+   rc = kstrtoul(buffer+1, 10, );
+   if (rc)
+   return rc;
if (clusterip_add_node(c, nodenum))
return -ENOMEM;
} else if (*buffer == '-') {
-   nodenum = simple_strtoul(buffer+1, NULL,10);
+   rc = kstrtoul(buffer+1, 10, );
+   if (rc)
+   return rc;
if (clusterip_del_node(c, nodenum))
return -ENOENT;
} else
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 49a1c70..6fb1168 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -220,7 +220,9 @@ static ssize_t sta_agg_status_write(struct file *file, 
const char __user *userbu
} else
return -EINVAL;
 
-   tid = simple_strtoul(buf, NULL, 0);
+   ret = kstrtoul(buf, 0, );
+   if (ret)
+   return ret;
 
if (tid >= IEEE80211_NUM_TIDS)
return -EINVAL;
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index af17516..08cdc71 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1409,7 +1409,7 @@ EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
 int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
-   int i, bucket;
+   int i, bucket, rc;
unsigned int hashsize, old_size;
struct hlist_nulls_head *hash, *old_hash;
struct nf_conntrack_tuple_hash *h;
@@ -1422,7 +1422,9 @@ int nf_conntrack_set_hashsize(const char *val, struct 
kernel_param *kp)
if (!nf_conntrack_htable_size)
return param_set_uint(val, kp);
 
-   hashsize = simple_strtoul(val, NULL, 0);
+   rc = kstrtouint(val, 0, );
+   if (rc)
+   return rc;
if (!hashsize)
return -EINVAL;
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND] net: remove obsolete simple_strto

2012-12-10 Thread Abhijit Pawar
On 12/11/2012 12:40 AM, David Miller wrote:
> From: Abhijit Pawar 
> Date: Mon, 10 Dec 2012 14:42:28 +0530
> 
>> This patch replace the obsolete simple_strto with kstrto
>>
>> Signed-off-by: Abhijit Pawar 
> 
> Applied.
> 
Hi David,
It seems that there are occurences of simple_strto* still present in the
couple of files which are not yet removed correctly by this patch. I
will send a modified patch shortly. Please revert this commit and use
the newly sent patch to merge with the tree.

-- 
-
Abhijit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND 1/4] mm: remove obsolete simple_strtoul

2012-12-10 Thread Abhijit Pawar
This patch replace the obsolete simple_strtoul with kstrtoul API.

Signed-off-by: Abhijit Pawar 
---
 mm/kmemleak.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index a217cc5..752a705 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1556,7 +1556,8 @@ static int dump_str_object_info(const char *str)
struct kmemleak_object *object;
unsigned long addr;
 
-   addr= simple_strtoul(str, NULL, 0);
+   if (kstrtoul(str, 0, ))
+   return -EINVAL;
object = find_and_get_object(addr, 0);
if (!object) {
pr_info("Unknown object at 0x%08lx\n", addr);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND] net: remove obsolete simple_strto

2012-12-10 Thread Abhijit Pawar
This patch replace the obsolete simple_strto with kstrto

Signed-off-by: Abhijit Pawar 
---
 net/core/netpoll.c |5 -
 net/ipv4/netfilter/ipt_CLUSTERIP.c |9 +++--
 net/mac80211/debugfs_sta.c |3 +++
 net/netfilter/nf_conntrack_core.c  |5 -
 4 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 77a0388..12c129f 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -674,7 +674,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed;
*delim = 0;
-   np->local_port = simple_strtol(cur, NULL, 10);
+   if (kstrtou16(cur, 10, >local_port))
+   goto parse_failed;
cur = delim;
}
cur++;
@@ -706,6 +707,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if (*cur == ' ' || *cur == '\t')
np_info(np, "warning: whitespace is not allowed\n");
np->remote_port = simple_strtol(cur, NULL, 10);
+   if (kstrtou16(cur, 10, >remote_port))
+   goto parse_failed;
cur = delim;
}
cur++;
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c 
b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index fe5daea..75e33a7 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -661,6 +661,7 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
 #define PROC_WRITELEN  10
char buffer[PROC_WRITELEN+1];
unsigned long nodenum;
+   int rc;
 
if (size > PROC_WRITELEN)
return -EIO;
@@ -669,11 +670,15 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
buffer[size] = 0;
 
if (*buffer == '+') {
-   nodenum = simple_strtoul(buffer+1, NULL, 10);
+   rc = kstrtoul(buffer+1, 10, );
+   if (rc)
+   return rc;
if (clusterip_add_node(c, nodenum))
return -ENOMEM;
} else if (*buffer == '-') {
-   nodenum = simple_strtoul(buffer+1, NULL,10);
+   rc = kstrtoul(buffer+1, 10, );
+   if (rc)
+   return rc;
if (clusterip_del_node(c, nodenum))
return -ENOENT;
} else
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 49a1c70..0dedb4b 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -221,6 +221,9 @@ static ssize_t sta_agg_status_write(struct file *file, 
const char __user *userbu
return -EINVAL;
 
tid = simple_strtoul(buf, NULL, 0);
+   ret = kstrtoul(buf, 0, );
+   if (ret)
+   return ret;
 
if (tid >= IEEE80211_NUM_TIDS)
return -EINVAL;
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index af17516..37d9e62 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1409,7 +1409,7 @@ EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
 int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
-   int i, bucket;
+   int i, bucket, rc;
unsigned int hashsize, old_size;
struct hlist_nulls_head *hash, *old_hash;
struct nf_conntrack_tuple_hash *h;
@@ -1423,6 +1423,9 @@ int nf_conntrack_set_hashsize(const char *val, struct 
kernel_param *kp)
return param_set_uint(val, kp);
 
hashsize = simple_strtoul(val, NULL, 0);
+   rc = kstrtouint(val, 0, );
+   if (rc)
+   return rc;
if (!hashsize)
return -EINVAL;
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND] net: remove obsolete simple_strtofoo

2012-12-10 Thread Abhijit Pawar
This patch replace the obsolete simple_strtofoo with kstrtofoo

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 net/core/netpoll.c |5 -
 net/ipv4/netfilter/ipt_CLUSTERIP.c |9 +++--
 net/mac80211/debugfs_sta.c |3 +++
 net/netfilter/nf_conntrack_core.c  |5 -
 4 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 77a0388..12c129f 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -674,7 +674,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed;
*delim = 0;
-   np-local_port = simple_strtol(cur, NULL, 10);
+   if (kstrtou16(cur, 10, np-local_port))
+   goto parse_failed;
cur = delim;
}
cur++;
@@ -706,6 +707,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if (*cur == ' ' || *cur == '\t')
np_info(np, warning: whitespace is not allowed\n);
np-remote_port = simple_strtol(cur, NULL, 10);
+   if (kstrtou16(cur, 10, np-remote_port))
+   goto parse_failed;
cur = delim;
}
cur++;
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c 
b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index fe5daea..75e33a7 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -661,6 +661,7 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
 #define PROC_WRITELEN  10
char buffer[PROC_WRITELEN+1];
unsigned long nodenum;
+   int rc;
 
if (size  PROC_WRITELEN)
return -EIO;
@@ -669,11 +670,15 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
buffer[size] = 0;
 
if (*buffer == '+') {
-   nodenum = simple_strtoul(buffer+1, NULL, 10);
+   rc = kstrtoul(buffer+1, 10, nodenum);
+   if (rc)
+   return rc;
if (clusterip_add_node(c, nodenum))
return -ENOMEM;
} else if (*buffer == '-') {
-   nodenum = simple_strtoul(buffer+1, NULL,10);
+   rc = kstrtoul(buffer+1, 10, nodenum);
+   if (rc)
+   return rc;
if (clusterip_del_node(c, nodenum))
return -ENOENT;
} else
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 49a1c70..0dedb4b 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -221,6 +221,9 @@ static ssize_t sta_agg_status_write(struct file *file, 
const char __user *userbu
return -EINVAL;
 
tid = simple_strtoul(buf, NULL, 0);
+   ret = kstrtoul(buf, 0, tid);
+   if (ret)
+   return ret;
 
if (tid = IEEE80211_NUM_TIDS)
return -EINVAL;
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index af17516..37d9e62 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1409,7 +1409,7 @@ EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
 int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
-   int i, bucket;
+   int i, bucket, rc;
unsigned int hashsize, old_size;
struct hlist_nulls_head *hash, *old_hash;
struct nf_conntrack_tuple_hash *h;
@@ -1423,6 +1423,9 @@ int nf_conntrack_set_hashsize(const char *val, struct 
kernel_param *kp)
return param_set_uint(val, kp);
 
hashsize = simple_strtoul(val, NULL, 0);
+   rc = kstrtouint(val, 0, hashsize);
+   if (rc)
+   return rc;
if (!hashsize)
return -EINVAL;
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND 1/4] mm: remove obsolete simple_strtoul

2012-12-10 Thread Abhijit Pawar
This patch replace the obsolete simple_strtoul with kstrtoul API.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 mm/kmemleak.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index a217cc5..752a705 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1556,7 +1556,8 @@ static int dump_str_object_info(const char *str)
struct kmemleak_object *object;
unsigned long addr;
 
-   addr= simple_strtoul(str, NULL, 0);
+   if (kstrtoul(str, 0, addr))
+   return -EINVAL;
object = find_and_get_object(addr, 0);
if (!object) {
pr_info(Unknown object at 0x%08lx\n, addr);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND] net: remove obsolete simple_strtofoo

2012-12-10 Thread Abhijit Pawar
On 12/11/2012 12:40 AM, David Miller wrote:
 From: Abhijit Pawar abhi.c.pa...@gmail.com
 Date: Mon, 10 Dec 2012 14:42:28 +0530
 
 This patch replace the obsolete simple_strtofoo with kstrtofoo

 Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
 
 Applied.
 
Hi David,
It seems that there are occurences of simple_strto* still present in the
couple of files which are not yet removed correctly by this patch. I
will send a modified patch shortly. Please revert this commit and use
the newly sent patch to merge with the tree.

-- 
-
Abhijit
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RESEND RESEND] net: remove obsolete simple_strtofoo

2012-12-10 Thread Abhijit Pawar
This patch replace the obsolete simple_strtofoo with kstrtofoo

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 net/core/netpoll.c |6 --
 net/ipv4/netfilter/ipt_CLUSTERIP.c |9 +++--
 net/mac80211/debugfs_sta.c |4 +++-
 net/netfilter/nf_conntrack_core.c  |6 --
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 77a0388..3151acf 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -674,7 +674,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed;
*delim = 0;
-   np-local_port = simple_strtol(cur, NULL, 10);
+   if (kstrtou16(cur, 10, np-local_port))
+   goto parse_failed;
cur = delim;
}
cur++;
@@ -705,7 +706,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
*delim = 0;
if (*cur == ' ' || *cur == '\t')
np_info(np, warning: whitespace is not allowed\n);
-   np-remote_port = simple_strtol(cur, NULL, 10);
+   if (kstrtou16(cur, 10, np-remote_port))
+   goto parse_failed;
cur = delim;
}
cur++;
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c 
b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index fe5daea..75e33a7 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -661,6 +661,7 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
 #define PROC_WRITELEN  10
char buffer[PROC_WRITELEN+1];
unsigned long nodenum;
+   int rc;
 
if (size  PROC_WRITELEN)
return -EIO;
@@ -669,11 +670,15 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
buffer[size] = 0;
 
if (*buffer == '+') {
-   nodenum = simple_strtoul(buffer+1, NULL, 10);
+   rc = kstrtoul(buffer+1, 10, nodenum);
+   if (rc)
+   return rc;
if (clusterip_add_node(c, nodenum))
return -ENOMEM;
} else if (*buffer == '-') {
-   nodenum = simple_strtoul(buffer+1, NULL,10);
+   rc = kstrtoul(buffer+1, 10, nodenum);
+   if (rc)
+   return rc;
if (clusterip_del_node(c, nodenum))
return -ENOENT;
} else
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 49a1c70..6fb1168 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -220,7 +220,9 @@ static ssize_t sta_agg_status_write(struct file *file, 
const char __user *userbu
} else
return -EINVAL;
 
-   tid = simple_strtoul(buf, NULL, 0);
+   ret = kstrtoul(buf, 0, tid);
+   if (ret)
+   return ret;
 
if (tid = IEEE80211_NUM_TIDS)
return -EINVAL;
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index af17516..08cdc71 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1409,7 +1409,7 @@ EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
 int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
-   int i, bucket;
+   int i, bucket, rc;
unsigned int hashsize, old_size;
struct hlist_nulls_head *hash, *old_hash;
struct nf_conntrack_tuple_hash *h;
@@ -1422,7 +1422,9 @@ int nf_conntrack_set_hashsize(const char *val, struct 
kernel_param *kp)
if (!nf_conntrack_htable_size)
return param_set_uint(val, kp);
 
-   hashsize = simple_strtoul(val, NULL, 0);
+   rc = kstrtouint(val, 0, hashsize);
+   if (rc)
+   return rc;
if (!hashsize)
return -EINVAL;
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND RESEND] net: remove obsolete simple_strtofoo

2012-12-10 Thread Abhijit Pawar
On 12/11/2012 10:19 AM, David Miller wrote:
 From: Abhijit Pawar abhi.c.pa...@gmail.com
 Date: Tue, 11 Dec 2012 09:04:20 +0530
 
 This patch replace the obsolete simple_strtofoo with kstrtofoo

 Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
 
 You can't submit replacement patches for ones which I have already
 applied.
 
 Patches I apply are permanently applied, and therefore you must submit
 changes relative the ones I've applied already.
 
I am sorry to create this confusion. I have created and sent the new
patch which you can apply over the old one to fix the issues.

-- 
-
Abhijit
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] net: remove obsolete simple_strtofoo

2012-12-10 Thread Abhijit Pawar
This patch removes the redundant occurences of simple_strtofoo

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 net/core/netpoll.c|1 -
 net/mac80211/debugfs_sta.c|1 -
 net/netfilter/nf_conntrack_core.c |1 -
 3 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 12c129f..3151acf 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -706,7 +706,6 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
*delim = 0;
if (*cur == ' ' || *cur == '\t')
np_info(np, warning: whitespace is not allowed\n);
-   np-remote_port = simple_strtol(cur, NULL, 10);
if (kstrtou16(cur, 10, np-remote_port))
goto parse_failed;
cur = delim;
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 0dedb4b..6fb1168 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -220,7 +220,6 @@ static ssize_t sta_agg_status_write(struct file *file, 
const char __user *userbu
} else
return -EINVAL;
 
-   tid = simple_strtoul(buf, NULL, 0);
ret = kstrtoul(buf, 0, tid);
if (ret)
return ret;
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index 37d9e62..08cdc71 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1422,7 +1422,6 @@ int nf_conntrack_set_hashsize(const char *val, struct 
kernel_param *kp)
if (!nf_conntrack_htable_size)
return param_set_uint(val, kp);
 
-   hashsize = simple_strtoul(val, NULL, 0);
rc = kstrtouint(val, 0, hashsize);
if (rc)
return rc;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] fs: remove obsolete simple_strto

2012-12-07 Thread Abhijit Pawar
This patch replace the obsolete simple_strto with kstrto

Signed-off-by: Abhijit Pawar 
---
 fs/9p/v9fs.c |6 +++---
 fs/btrfs/ioctl.c |6 +-
 fs/cifs/cifs_debug.c |6 --
 fs/dlm/config.c  |   25 -
 fs/dlm/lockspace.c   |   20 
 fs/xfs/xfs_super.c   |   19 ++-
 6 files changed, 62 insertions(+), 20 deletions(-)

diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index d934f04..e5ec1ea 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -112,7 +112,7 @@ static int v9fs_parse_options(struct v9fs_session_info 
*v9ses, char *opts)
substring_t args[MAX_OPT_ARGS];
char *p;
int option = 0;
-   char *s, *e;
+   char *s;
int ret = 0;
 
/* setup defaults */
@@ -249,8 +249,8 @@ static int v9fs_parse_options(struct v9fs_session_info 
*v9ses, char *opts)
v9ses->flags |= V9FS_ACCESS_CLIENT;
} else {
v9ses->flags |= V9FS_ACCESS_SINGLE;
-   v9ses->uid = simple_strtoul(s, , 10);
-   if (*e != '\0') {
+   ret = kstrtouint(s, 10, >uid);
+   if (ret) {
ret = -EINVAL;
pr_info("Unknown access argument %s\n",
s);
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 5b3429a..95d9e09 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1335,7 +1335,11 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root 
*root,
sizestr = devstr + 1;
*devstr = '\0';
devstr = vol_args->name;
-   devid = simple_strtoull(devstr, , 10);
+   ret = kstrtoull(devstr, 10, );
+   if (ret) {
+   ret = -EINVAL;
+   goto out_free;
+   }
printk(KERN_INFO "btrfs: resizing devid %llu\n",
   (unsigned long long)devid);
}
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index d9ea6ed..65936f8 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -584,6 +584,7 @@ static ssize_t cifs_security_flags_proc_write(struct file 
*file,
unsigned int flags;
char flags_string[12];
char c;
+   int rc;
 
if ((count < 1) || (count > 11))
return -EINVAL;
@@ -609,8 +610,9 @@ static ssize_t cifs_security_flags_proc_write(struct file 
*file,
}
/* else we have a number */
 
-   flags = simple_strtoul(flags_string, NULL, 0);
-
+   rc = kstrtouint(flags_string, 0, );
+   if (rc)
+   return -EINVAL;
cFYI(1, "sec flags 0x%x", flags);
 
if (flags <= 0)  {
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 7d58d5b..38d164b 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -156,11 +156,14 @@ static ssize_t cluster_set(struct dlm_cluster *cl, 
unsigned int *cl_field,
   const char *buf, size_t len)
 {
unsigned int x;
+   int rc;
 
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
 
-   x = simple_strtoul(buf, NULL, 0);
+   rc = kstrtouint(buf, 0, );
+   if (rc)
+   return -EINVAL;
 
if (check_zero && !x)
return -EINVAL;
@@ -729,7 +732,10 @@ static ssize_t comm_nodeid_read(struct dlm_comm *cm, char 
*buf)
 static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf,
 size_t len)
 {
-   cm->nodeid = simple_strtol(buf, NULL, 0);
+   int rc;
+   rc = kstrtoint(buf, 0, >nodeid);
+   if (rc)
+   return -EINVAL;
return len;
 }
 
@@ -741,7 +747,10 @@ static ssize_t comm_local_read(struct dlm_comm *cm, char 
*buf)
 static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf,
size_t len)
 {
-   cm->local= simple_strtol(buf, NULL, 0);
+   int rc;
+   rc = kstrtoint(buf, 0, >local);
+   if (rc)
+   return -EINVAL;
if (cm->local && !local_comm)
local_comm = cm;
return len;
@@ -845,7 +854,10 @@ static ssize_t node_nodeid_write(struct dlm_node *nd, 
const char *buf,
 size_t len)
 {
uint32_t seq = 0;
-   nd->nodeid = simple_strtol(buf, NULL, 0);
+   int rc;
+   rc = kstrtoint(buf, 0, >nodeid);
+   if (rc)
+   return -EINVAL;
dlm_comm_seq(nd->nodeid, );
nd->comm_seq = seq;
return len;
@@ -859,7 +871,10 @@ static ssize_t node_weight_read(struct dlm_node *nd, char 
*buf)
 static ssize_t node_weight_write(struct dlm_node *nd, const char *buf,
 size_t len

[PATCH 3/4] include/sunrpc: remove obsolete simple_strto

2012-12-07 Thread Abhijit Pawar
This patch replace the obsolete simple_strto with kstrto

Signed-off-by: Abhijit Pawar 
---
 include/linux/sunrpc/cache.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 5dc9ee4..96d2545 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -218,7 +218,7 @@ static inline int get_int(char **bpp, int *anint)
 {
char buf[50];
char *ep;
-   int rv;
+   int rv, rc;
int len = qword_get(bpp, buf, sizeof(buf));
 
if (len < 0)
@@ -226,8 +226,8 @@ static inline int get_int(char **bpp, int *anint)
if (len == 0)
return -ENOENT;
 
-   rv = simple_strtol(buf, , 0);
-   if (*ep)
+   rc = kstrtoint(buf, 0, );
+   if (rc)
return -EINVAL;
 
*anint = rv;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] net: remove obsolete simple_strto

2012-12-07 Thread Abhijit Pawar
This patch replace the obsolete simple_strto with kstrto

Signed-off-by: Abhijit Pawar 
---
 net/core/netpoll.c |9 +++--
 net/ipv4/netfilter/ipt_CLUSTERIP.c |9 +++--
 net/mac80211/debugfs_sta.c |4 +++-
 net/netfilter/nf_conntrack_core.c  |6 --
 4 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 77a0388..596b127 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -668,13 +668,16 @@ EXPORT_SYMBOL(netpoll_print_options);
 
 int netpoll_parse_options(struct netpoll *np, char *opt)
 {
+   int rc;
char *cur=opt, *delim;
 
if (*cur != '@') {
if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed;
*delim = 0;
-   np->local_port = simple_strtol(cur, NULL, 10);
+   rc = kstrtol(cur, 10, >local_port);
+   if (rc)
+   goto parse_failed;
cur = delim;
}
cur++;
@@ -705,7 +708,9 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
*delim = 0;
if (*cur == ' ' || *cur == '\t')
np_info(np, "warning: whitespace is not allowed\n");
-   np->remote_port = simple_strtol(cur, NULL, 10);
+   rc = kstrtol(cur, 10, >remote_port);
+   if (rc)
+   goto parse_failed;
cur = delim;
}
cur++;
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c 
b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index fe5daea..55e7b73 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -661,6 +661,7 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
 #define PROC_WRITELEN  10
char buffer[PROC_WRITELEN+1];
unsigned long nodenum;
+   int rc;
 
if (size > PROC_WRITELEN)
return -EIO;
@@ -669,11 +670,15 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
buffer[size] = 0;
 
if (*buffer == '+') {
-   nodenum = simple_strtoul(buffer+1, NULL, 10);
+   rc = kstrtoul(buffer+1, 10, );
+   if (rc)
+   return -EINVAL;
if (clusterip_add_node(c, nodenum))
return -ENOMEM;
} else if (*buffer == '-') {
-   nodenum = simple_strtoul(buffer+1, NULL,10);
+   rc = kstrtoul(buffer+1, 10, );
+   if (rc)
+   return -EINVAL;
if (clusterip_del_node(c, nodenum))
return -ENOENT;
} else
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 89281d2..18754fd 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -219,7 +219,9 @@ static ssize_t sta_agg_status_write(struct file *file, 
const char __user *userbu
} else
return -EINVAL;
 
-   tid = simple_strtoul(buf, NULL, 0);
+   ret = kstrtoul(buf, 0, );
+   if (ret)
+   return -EINVAL;
 
if (tid >= IEEE80211_NUM_TIDS)
return -EINVAL;
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index af17516..18ce24b 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1409,7 +1409,7 @@ EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
 int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
-   int i, bucket;
+   int i, bucket, rc;
unsigned int hashsize, old_size;
struct hlist_nulls_head *hash, *old_hash;
struct nf_conntrack_tuple_hash *h;
@@ -1422,7 +1422,9 @@ int nf_conntrack_set_hashsize(const char *val, struct 
kernel_param *kp)
if (!nf_conntrack_htable_size)
return param_set_uint(val, kp);
 
-   hashsize = simple_strtoul(val, NULL, 0);
+   rc = kstrtouint(val, 0, );
+   if (rc)
+   return -EINVAL;
if (!hashsize)
return -EINVAL;
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] mm: remove obsolete simple_strtoul

2012-12-07 Thread Abhijit Pawar
This patch replace the obsolete simple_strtoul with kstrtoul API.

Signed-off-by: Abhijit Pawar 
---
 mm/kmemleak.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index a217cc5..b141532 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1555,8 +1555,11 @@ static int dump_str_object_info(const char *str)
unsigned long flags;
struct kmemleak_object *object;
unsigned long addr;
+   int rc;
 
-   addr= simple_strtoul(str, NULL, 0);
+   rc = kstrtoul(str, 0, );
+   if (rc)
+   return -EINVAL;
object = find_and_get_object(addr, 0);
if (!object) {
pr_info("Unknown object at 0x%08lx\n", addr);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] mm: remove obsolete simple_strtoul

2012-12-07 Thread Abhijit Pawar
This patch replace the obsolete simple_strtoul with kstrtoul API.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 mm/kmemleak.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index a217cc5..b141532 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1555,8 +1555,11 @@ static int dump_str_object_info(const char *str)
unsigned long flags;
struct kmemleak_object *object;
unsigned long addr;
+   int rc;
 
-   addr= simple_strtoul(str, NULL, 0);
+   rc = kstrtoul(str, 0, addr);
+   if (rc)
+   return -EINVAL;
object = find_and_get_object(addr, 0);
if (!object) {
pr_info(Unknown object at 0x%08lx\n, addr);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] net: remove obsolete simple_strtofoo

2012-12-07 Thread Abhijit Pawar
This patch replace the obsolete simple_strtofoo with kstrtofoo

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 net/core/netpoll.c |9 +++--
 net/ipv4/netfilter/ipt_CLUSTERIP.c |9 +++--
 net/mac80211/debugfs_sta.c |4 +++-
 net/netfilter/nf_conntrack_core.c  |6 --
 4 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 77a0388..596b127 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -668,13 +668,16 @@ EXPORT_SYMBOL(netpoll_print_options);
 
 int netpoll_parse_options(struct netpoll *np, char *opt)
 {
+   int rc;
char *cur=opt, *delim;
 
if (*cur != '@') {
if ((delim = strchr(cur, '@')) == NULL)
goto parse_failed;
*delim = 0;
-   np-local_port = simple_strtol(cur, NULL, 10);
+   rc = kstrtol(cur, 10, np-local_port);
+   if (rc)
+   goto parse_failed;
cur = delim;
}
cur++;
@@ -705,7 +708,9 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
*delim = 0;
if (*cur == ' ' || *cur == '\t')
np_info(np, warning: whitespace is not allowed\n);
-   np-remote_port = simple_strtol(cur, NULL, 10);
+   rc = kstrtol(cur, 10, np-remote_port);
+   if (rc)
+   goto parse_failed;
cur = delim;
}
cur++;
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c 
b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index fe5daea..55e7b73 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -661,6 +661,7 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
 #define PROC_WRITELEN  10
char buffer[PROC_WRITELEN+1];
unsigned long nodenum;
+   int rc;
 
if (size  PROC_WRITELEN)
return -EIO;
@@ -669,11 +670,15 @@ static ssize_t clusterip_proc_write(struct file *file, 
const char __user *input,
buffer[size] = 0;
 
if (*buffer == '+') {
-   nodenum = simple_strtoul(buffer+1, NULL, 10);
+   rc = kstrtoul(buffer+1, 10, nodenum);
+   if (rc)
+   return -EINVAL;
if (clusterip_add_node(c, nodenum))
return -ENOMEM;
} else if (*buffer == '-') {
-   nodenum = simple_strtoul(buffer+1, NULL,10);
+   rc = kstrtoul(buffer+1, 10, nodenum);
+   if (rc)
+   return -EINVAL;
if (clusterip_del_node(c, nodenum))
return -ENOENT;
} else
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 89281d2..18754fd 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -219,7 +219,9 @@ static ssize_t sta_agg_status_write(struct file *file, 
const char __user *userbu
} else
return -EINVAL;
 
-   tid = simple_strtoul(buf, NULL, 0);
+   ret = kstrtoul(buf, 0, tid);
+   if (ret)
+   return -EINVAL;
 
if (tid = IEEE80211_NUM_TIDS)
return -EINVAL;
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index af17516..18ce24b 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1409,7 +1409,7 @@ EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
 int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
-   int i, bucket;
+   int i, bucket, rc;
unsigned int hashsize, old_size;
struct hlist_nulls_head *hash, *old_hash;
struct nf_conntrack_tuple_hash *h;
@@ -1422,7 +1422,9 @@ int nf_conntrack_set_hashsize(const char *val, struct 
kernel_param *kp)
if (!nf_conntrack_htable_size)
return param_set_uint(val, kp);
 
-   hashsize = simple_strtoul(val, NULL, 0);
+   rc = kstrtouint(val, 0, hashsize);
+   if (rc)
+   return -EINVAL;
if (!hashsize)
return -EINVAL;
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] include/sunrpc: remove obsolete simple_strtofoo

2012-12-07 Thread Abhijit Pawar
This patch replace the obsolete simple_strtofoo with kstrtofoo

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 include/linux/sunrpc/cache.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 5dc9ee4..96d2545 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -218,7 +218,7 @@ static inline int get_int(char **bpp, int *anint)
 {
char buf[50];
char *ep;
-   int rv;
+   int rv, rc;
int len = qword_get(bpp, buf, sizeof(buf));
 
if (len  0)
@@ -226,8 +226,8 @@ static inline int get_int(char **bpp, int *anint)
if (len == 0)
return -ENOENT;
 
-   rv = simple_strtol(buf, ep, 0);
-   if (*ep)
+   rc = kstrtoint(buf, 0, rv);
+   if (rc)
return -EINVAL;
 
*anint = rv;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] fs: remove obsolete simple_strtofoo

2012-12-07 Thread Abhijit Pawar
This patch replace the obsolete simple_strtofoo with kstrtofoo

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/9p/v9fs.c |6 +++---
 fs/btrfs/ioctl.c |6 +-
 fs/cifs/cifs_debug.c |6 --
 fs/dlm/config.c  |   25 -
 fs/dlm/lockspace.c   |   20 
 fs/xfs/xfs_super.c   |   19 ++-
 6 files changed, 62 insertions(+), 20 deletions(-)

diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index d934f04..e5ec1ea 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -112,7 +112,7 @@ static int v9fs_parse_options(struct v9fs_session_info 
*v9ses, char *opts)
substring_t args[MAX_OPT_ARGS];
char *p;
int option = 0;
-   char *s, *e;
+   char *s;
int ret = 0;
 
/* setup defaults */
@@ -249,8 +249,8 @@ static int v9fs_parse_options(struct v9fs_session_info 
*v9ses, char *opts)
v9ses-flags |= V9FS_ACCESS_CLIENT;
} else {
v9ses-flags |= V9FS_ACCESS_SINGLE;
-   v9ses-uid = simple_strtoul(s, e, 10);
-   if (*e != '\0') {
+   ret = kstrtouint(s, 10, v9ses-uid);
+   if (ret) {
ret = -EINVAL;
pr_info(Unknown access argument %s\n,
s);
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 5b3429a..95d9e09 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1335,7 +1335,11 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root 
*root,
sizestr = devstr + 1;
*devstr = '\0';
devstr = vol_args-name;
-   devid = simple_strtoull(devstr, end, 10);
+   ret = kstrtoull(devstr, 10, devid);
+   if (ret) {
+   ret = -EINVAL;
+   goto out_free;
+   }
printk(KERN_INFO btrfs: resizing devid %llu\n,
   (unsigned long long)devid);
}
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index d9ea6ed..65936f8 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -584,6 +584,7 @@ static ssize_t cifs_security_flags_proc_write(struct file 
*file,
unsigned int flags;
char flags_string[12];
char c;
+   int rc;
 
if ((count  1) || (count  11))
return -EINVAL;
@@ -609,8 +610,9 @@ static ssize_t cifs_security_flags_proc_write(struct file 
*file,
}
/* else we have a number */
 
-   flags = simple_strtoul(flags_string, NULL, 0);
-
+   rc = kstrtouint(flags_string, 0, flags);
+   if (rc)
+   return -EINVAL;
cFYI(1, sec flags 0x%x, flags);
 
if (flags = 0)  {
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 7d58d5b..38d164b 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -156,11 +156,14 @@ static ssize_t cluster_set(struct dlm_cluster *cl, 
unsigned int *cl_field,
   const char *buf, size_t len)
 {
unsigned int x;
+   int rc;
 
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
 
-   x = simple_strtoul(buf, NULL, 0);
+   rc = kstrtouint(buf, 0, x);
+   if (rc)
+   return -EINVAL;
 
if (check_zero  !x)
return -EINVAL;
@@ -729,7 +732,10 @@ static ssize_t comm_nodeid_read(struct dlm_comm *cm, char 
*buf)
 static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf,
 size_t len)
 {
-   cm-nodeid = simple_strtol(buf, NULL, 0);
+   int rc;
+   rc = kstrtoint(buf, 0, cm-nodeid);
+   if (rc)
+   return -EINVAL;
return len;
 }
 
@@ -741,7 +747,10 @@ static ssize_t comm_local_read(struct dlm_comm *cm, char 
*buf)
 static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf,
size_t len)
 {
-   cm-local= simple_strtol(buf, NULL, 0);
+   int rc;
+   rc = kstrtoint(buf, 0, cm-local);
+   if (rc)
+   return -EINVAL;
if (cm-local  !local_comm)
local_comm = cm;
return len;
@@ -845,7 +854,10 @@ static ssize_t node_nodeid_write(struct dlm_node *nd, 
const char *buf,
 size_t len)
 {
uint32_t seq = 0;
-   nd-nodeid = simple_strtol(buf, NULL, 0);
+   int rc;
+   rc = kstrtoint(buf, 0, nd-nodeid);
+   if (rc)
+   return -EINVAL;
dlm_comm_seq(nd-nodeid, seq);
nd-comm_seq = seq;
return len;
@@ -859,7 +871,10 @@ static ssize_t node_weight_read(struct dlm_node *nd, char 
*buf)
 static ssize_t node_weight_write(struct dlm_node *nd, const char *buf,
 size_t len)
 {
-   nd-weight = simple_strtol(buf, NULL, 0

Re: [RESEND PATCH] fs/super.c set_anon_super calling optimization

2012-11-29 Thread Abhijit Pawar
On 11/30/2012 09:35 AM, Al Viro wrote:
> On Fri, Oct 26, 2012 at 11:14:41AM -0200, Carlos Maiolino wrote:
>> Hi,
>>
>> On Thu, Oct 25, 2012 at 05:08:19PM +0530, Abhijit Pawar wrote:
>>> Hi,
>>> set_anon_super is called by many filesystems. Some call directly and
>>> some call through the wrapper. Many of them in the wrapper's call to
>>> this function are passing the second argument to this function which
>>> is not used anywhere.
>>>
>>> This patch replaces the second variable with NULL.
>>>
>>
>> If the variable isn't used anymore, why don't just get rid of it, instead of
>> call the function passing a NULL pointer on it?
> 
>   Because we want it to be a valid sget() callback.  I doubt that this
> optimization is worth doing, though - might even micro-pessimize the things
> on architectures where all arguments are passed in registers.
> 
Al,
Yes. it will be helpful in registers case.

-- 
-
Abhijit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 6/6] fs:sysfs pass NULL as second parameter for set_anon_super

2012-11-29 Thread Abhijit Pawar
On 11/29/2012 09:06 PM, Greg Kroah-Hartman wrote:
> On Thu, Nov 29, 2012 at 12:05:45PM +0530, Abhijit Pawar wrote:
>> set_anon_super does not use the second parameter in its implementation.
>> So there is no need to pass on the second parameter.
> 
> Why not just remove the second parameter from the call then?
> 
> thanks,
> 
> greg k-h
> 

This is used as a callback function. So changing the signature will
affect many other filesystems who use the default function rather than
the overridden one.


-- 
-
Abhijit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 6/6] fs:sysfs pass NULL as second parameter for set_anon_super

2012-11-29 Thread Abhijit Pawar
On 11/29/2012 09:06 PM, Greg Kroah-Hartman wrote:
 On Thu, Nov 29, 2012 at 12:05:45PM +0530, Abhijit Pawar wrote:
 set_anon_super does not use the second parameter in its implementation.
 So there is no need to pass on the second parameter.
 
 Why not just remove the second parameter from the call then?
 
 thanks,
 
 greg k-h
 

This is used as a callback function. So changing the signature will
affect many other filesystems who use the default function rather than
the overridden one.


-- 
-
Abhijit
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND PATCH] fs/super.c set_anon_super calling optimization

2012-11-29 Thread Abhijit Pawar
On 11/30/2012 09:35 AM, Al Viro wrote:
 On Fri, Oct 26, 2012 at 11:14:41AM -0200, Carlos Maiolino wrote:
 Hi,

 On Thu, Oct 25, 2012 at 05:08:19PM +0530, Abhijit Pawar wrote:
 Hi,
 set_anon_super is called by many filesystems. Some call directly and
 some call through the wrapper. Many of them in the wrapper's call to
 this function are passing the second argument to this function which
 is not used anywhere.

 This patch replaces the second variable with NULL.


 If the variable isn't used anymore, why don't just get rid of it, instead of
 call the function passing a NULL pointer on it?
 
   Because we want it to be a valid sget() callback.  I doubt that this
 optimization is worth doing, though - might even micro-pessimize the things
 on architectures where all arguments are passed in registers.
 
Al,
Yes. it will be helpful in registers case.

-- 
-
Abhijit
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/6] fs:sysfs pass NULL as second parameter for set_anon_super

2012-11-28 Thread Abhijit Pawar
set_anon_super does not use the second parameter in its implementation.
So there is no need to pass on the second parameter.

Signed-off-by: Abhijit Pawar 
---
 fs/sysfs/mount.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index db940a9..3e3f7ea 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -89,7 +89,7 @@ static int sysfs_test_super(struct super_block *sb, void 
*data)
 static int sysfs_set_super(struct super_block *sb, void *data)
 {
int error;
-   error = set_anon_super(sb, data);
+   error = set_anon_super(sb, NULL);
if (!error)
sb->s_fs_info = data;
return error;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/6] fs:nfs pass NULL as second parameter for set_anon_super

2012-11-28 Thread Abhijit Pawar
set_anon_super does not use the second parameter in its implementation.
So there is no need to pass on the second parameter.

Signed-off-by: Abhijit Pawar 
---
 fs/nfs/super.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index e12cea4..c8bdd86 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2310,7 +2310,7 @@ static int nfs_set_super(struct super_block *s, void 
*data)
s->s_flags = sb_mntdata->mntflags;
s->s_fs_info = server;
s->s_d_op = server->nfs_client->rpc_ops->dentry_ops;
-   ret = set_anon_super(s, server);
+   ret = set_anon_super(s, NULL);
if (ret == 0)
server->s_dev = s->s_dev;
return ret;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] fs:btrfs pass NULL as second parameter for set_anon_super

2012-11-28 Thread Abhijit Pawar
set_anon_super does not use the second parameter in its implementation.
So there is no need to pass on the second parameter. 

Signed-off-by: Abhijit Pawar 
---
 fs/btrfs/super.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 915ac14..c9994a3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -954,7 +954,7 @@ static int btrfs_test_super(struct super_block *s, void 
*data)
 
 static int btrfs_set_super(struct super_block *s, void *data)
 {
-   int err = set_anon_super(s, data);
+   int err = set_anon_super(s, NULL);
if (!err)
s->s_fs_info = data;
return err;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] fs: 9p pass NULL as second parameter for set_anon_super

2012-11-28 Thread Abhijit Pawar
set_anon_super does not use the second parameter in its implementation. 
So there is no need to pass on the second parameter.

Signed-off-by: Abhijit Pawar 
---
 fs/9p/vfs_super.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 137d503..132db90 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -61,7 +61,7 @@ static const struct super_operations v9fs_super_ops, 
v9fs_super_ops_dotl;
 static int v9fs_set_super(struct super_block *s, void *data)
 {
s->s_fs_info = data;
-   return set_anon_super(s, data);
+   return set_anon_super(s, NULL);
 }
 
 /**
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] fs: 9p pass NULL as second parameter for set_anon_super

2012-11-28 Thread Abhijit Pawar
set_anon_super does not use the second parameter in its implementation. 
So there is no need to pass on the second parameter.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/9p/vfs_super.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 137d503..132db90 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -61,7 +61,7 @@ static const struct super_operations v9fs_super_ops, 
v9fs_super_ops_dotl;
 static int v9fs_set_super(struct super_block *s, void *data)
 {
s-s_fs_info = data;
-   return set_anon_super(s, data);
+   return set_anon_super(s, NULL);
 }
 
 /**
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] fs:btrfs pass NULL as second parameter for set_anon_super

2012-11-28 Thread Abhijit Pawar
set_anon_super does not use the second parameter in its implementation.
So there is no need to pass on the second parameter. 

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/btrfs/super.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 915ac14..c9994a3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -954,7 +954,7 @@ static int btrfs_test_super(struct super_block *s, void 
*data)
 
 static int btrfs_set_super(struct super_block *s, void *data)
 {
-   int err = set_anon_super(s, data);
+   int err = set_anon_super(s, NULL);
if (!err)
s-s_fs_info = data;
return err;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/6] fs:nfs pass NULL as second parameter for set_anon_super

2012-11-28 Thread Abhijit Pawar
set_anon_super does not use the second parameter in its implementation.
So there is no need to pass on the second parameter.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/nfs/super.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index e12cea4..c8bdd86 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2310,7 +2310,7 @@ static int nfs_set_super(struct super_block *s, void 
*data)
s-s_flags = sb_mntdata-mntflags;
s-s_fs_info = server;
s-s_d_op = server-nfs_client-rpc_ops-dentry_ops;
-   ret = set_anon_super(s, server);
+   ret = set_anon_super(s, NULL);
if (ret == 0)
server-s_dev = s-s_dev;
return ret;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/6] fs:sysfs pass NULL as second parameter for set_anon_super

2012-11-28 Thread Abhijit Pawar
set_anon_super does not use the second parameter in its implementation.
So there is no need to pass on the second parameter.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/sysfs/mount.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index db940a9..3e3f7ea 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -89,7 +89,7 @@ static int sysfs_test_super(struct super_block *sb, void 
*data)
 static int sysfs_set_super(struct super_block *sb, void *data)
 {
int error;
-   error = set_anon_super(sb, data);
+   error = set_anon_super(sb, NULL);
if (!error)
sb-s_fs_info = data;
return error;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] fs: logfs NULL pointer check added

2012-11-27 Thread Abhijit Pawar
This patches fixes the case where the NULL inode may be passed to get the page 
for writing.

Signed-off-by: Abhijit Pawar 
---
 fs/logfs/readwrite.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c
index 53596ce..55b45fb 100644
--- a/fs/logfs/readwrite.c
+++ b/fs/logfs/readwrite.c
@@ -2201,6 +2201,7 @@ void btree_write_block(struct logfs_block *block)
int err, cookie;
 
inode = logfs_safe_iget(block->sb, block->ino, );
+   BUG_ON(!inode);
page = logfs_get_write_page(inode, block->bix, block->level);
BUG_ON(!page);
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] fs: logfs NULL pointer check added

2012-11-27 Thread Abhijit Pawar
This patch fixes  Bug 49921 - Missing NULL check of return value of 
logfs_get_write_page() in function btree_write_block()

Signed-off-by: Abhijit Pawar 
---
 fs/logfs/readwrite.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c
index e1a3b6b..53596ce 100644
--- a/fs/logfs/readwrite.c
+++ b/fs/logfs/readwrite.c
@@ -2202,6 +2202,7 @@ void btree_write_block(struct logfs_block *block)
 
inode = logfs_safe_iget(block->sb, block->ino, );
page = logfs_get_write_page(inode, block->bix, block->level);
+   BUG_ON(!page);
 
err = logfs_readpage_nolock(page);
BUG_ON(err);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] fs: logfs NULL pointer check added

2012-11-27 Thread Abhijit Pawar
This patch fixes  Bug 49921 - Missing NULL check of return value of 
logfs_get_write_page() in function btree_write_block()

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/logfs/readwrite.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c
index e1a3b6b..53596ce 100644
--- a/fs/logfs/readwrite.c
+++ b/fs/logfs/readwrite.c
@@ -2202,6 +2202,7 @@ void btree_write_block(struct logfs_block *block)
 
inode = logfs_safe_iget(block-sb, block-ino, cookie);
page = logfs_get_write_page(inode, block-bix, block-level);
+   BUG_ON(!page);
 
err = logfs_readpage_nolock(page);
BUG_ON(err);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] fs: logfs NULL pointer check added

2012-11-27 Thread Abhijit Pawar
This patches fixes the case where the NULL inode may be passed to get the page 
for writing.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/logfs/readwrite.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c
index 53596ce..55b45fb 100644
--- a/fs/logfs/readwrite.c
+++ b/fs/logfs/readwrite.c
@@ -2201,6 +2201,7 @@ void btree_write_block(struct logfs_block *block)
int err, cookie;
 
inode = logfs_safe_iget(block-sb, block-ino, cookie);
+   BUG_ON(!inode);
page = logfs_get_write_page(inode, block-bix, block-level);
BUG_ON(!page);
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] fs:ecryptfs basic code optimization

2012-11-12 Thread Abhijit Pawar
crypto.c: modified if() check in ecryptfs_encrypt_and_encode_filename(). It 
will evaluate only once and we use that evaluation result again later instead 
of re-evaluating the condition.

Signed-off-by: Abhijit Pawar 
---
 fs/ecryptfs/crypto.c |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index ea99312..b5e4836 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -2086,6 +2086,7 @@ int ecryptfs_encrypt_and_encode_filename(
|| (mount_crypt_stat && (mount_crypt_stat->flags
 & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES))) {
struct ecryptfs_filename *filename;
+   bool flag = false;
 
filename = kzalloc(sizeof(*filename), GFP_KERNEL);
if (!filename) {
@@ -2113,10 +2114,12 @@ int ecryptfs_encrypt_and_encode_filename(
& ECRYPTFS_ENCFN_USE_MOUNT_FNEK))
|| (mount_crypt_stat
&& (mount_crypt_stat->flags
-   & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK)))
+   & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK))) {
(*encoded_name_size) =
(ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE
 + encoded_name_no_prefix_size);
+   flag = true;
+   }
else
(*encoded_name_size) =
(ECRYPTFS_FEK_ENCRYPTED_FILENAME_PREFIX_SIZE
@@ -2131,11 +2134,7 @@ int ecryptfs_encrypt_and_encode_filename(
kfree(filename);
goto out;
}
-   if ((crypt_stat && (crypt_stat->flags
-   & ECRYPTFS_ENCFN_USE_MOUNT_FNEK))
-   || (mount_crypt_stat
-   && (mount_crypt_stat->flags
-   & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK))) {
+   if (flag) {
memcpy((*encoded_name),
   ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX,
   ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] fs:ecryptfs basic code optimization

2012-11-12 Thread Abhijit Pawar
debug.c: ecryptfs_dump_auth_tok () : salt and sig arrays initialized so as to 
avoid adding null terminator explicitly.

Signed-off-by: Abhijit Pawar 
---
 fs/ecryptfs/debug.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ecryptfs/debug.c b/fs/ecryptfs/debug.c
index 3d2bdf5..480e3b5 100644
--- a/fs/ecryptfs/debug.c
+++ b/fs/ecryptfs/debug.c
@@ -31,8 +31,8 @@
  */
 void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok *auth_tok)
 {
-   char salt[ECRYPTFS_SALT_SIZE * 2 + 1];
-   char sig[ECRYPTFS_SIG_SIZE_HEX + 1];
+   char salt[ECRYPTFS_SALT_SIZE * 2 + 1] = {'\0'};
+   char sig[ECRYPTFS_SIG_SIZE_HEX + 1] = {'\0'};
 
ecryptfs_printk(KERN_DEBUG, "Auth tok at mem loc [%p]:\n",
auth_tok);
@@ -42,7 +42,6 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok 
*auth_tok)
ecryptfs_printk(KERN_DEBUG, " * passphrase type\n");
ecryptfs_to_hex(salt, auth_tok->token.password.salt,
ECRYPTFS_SALT_SIZE);
-   salt[ECRYPTFS_SALT_SIZE * 2] = '\0';
ecryptfs_printk(KERN_DEBUG, " * salt = [%s]\n", salt);
if (auth_tok->token.password.flags &
ECRYPTFS_PERSISTENT_PASSWORD) {
@@ -50,7 +49,6 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok 
*auth_tok)
}
memcpy(sig, auth_tok->token.password.signature,
   ECRYPTFS_SIG_SIZE_HEX);
-   sig[ECRYPTFS_SIG_SIZE_HEX] = '\0';
ecryptfs_printk(KERN_DEBUG, " * signature = [%s]\n", sig);
}
ecryptfs_printk(KERN_DEBUG, " * session_key.flags = [0x%x]\n",
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] fs:ecryptfs basic code optimization

2012-11-12 Thread Abhijit Pawar
debug.c: ecryptfs_dump_auth_tok () : salt and sig arrays initialized so as to 
avoid adding null terminator explicitly.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/ecryptfs/debug.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ecryptfs/debug.c b/fs/ecryptfs/debug.c
index 3d2bdf5..480e3b5 100644
--- a/fs/ecryptfs/debug.c
+++ b/fs/ecryptfs/debug.c
@@ -31,8 +31,8 @@
  */
 void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok *auth_tok)
 {
-   char salt[ECRYPTFS_SALT_SIZE * 2 + 1];
-   char sig[ECRYPTFS_SIG_SIZE_HEX + 1];
+   char salt[ECRYPTFS_SALT_SIZE * 2 + 1] = {'\0'};
+   char sig[ECRYPTFS_SIG_SIZE_HEX + 1] = {'\0'};
 
ecryptfs_printk(KERN_DEBUG, Auth tok at mem loc [%p]:\n,
auth_tok);
@@ -42,7 +42,6 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok 
*auth_tok)
ecryptfs_printk(KERN_DEBUG,  * passphrase type\n);
ecryptfs_to_hex(salt, auth_tok-token.password.salt,
ECRYPTFS_SALT_SIZE);
-   salt[ECRYPTFS_SALT_SIZE * 2] = '\0';
ecryptfs_printk(KERN_DEBUG,  * salt = [%s]\n, salt);
if (auth_tok-token.password.flags 
ECRYPTFS_PERSISTENT_PASSWORD) {
@@ -50,7 +49,6 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok 
*auth_tok)
}
memcpy(sig, auth_tok-token.password.signature,
   ECRYPTFS_SIG_SIZE_HEX);
-   sig[ECRYPTFS_SIG_SIZE_HEX] = '\0';
ecryptfs_printk(KERN_DEBUG,  * signature = [%s]\n, sig);
}
ecryptfs_printk(KERN_DEBUG,  * session_key.flags = [0x%x]\n,
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] fs:ecryptfs basic code optimization

2012-11-12 Thread Abhijit Pawar
crypto.c: modified if() check in ecryptfs_encrypt_and_encode_filename(). It 
will evaluate only once and we use that evaluation result again later instead 
of re-evaluating the condition.

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
---
 fs/ecryptfs/crypto.c |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index ea99312..b5e4836 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -2086,6 +2086,7 @@ int ecryptfs_encrypt_and_encode_filename(
|| (mount_crypt_stat  (mount_crypt_stat-flags
  ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES))) {
struct ecryptfs_filename *filename;
+   bool flag = false;
 
filename = kzalloc(sizeof(*filename), GFP_KERNEL);
if (!filename) {
@@ -2113,10 +2114,12 @@ int ecryptfs_encrypt_and_encode_filename(
 ECRYPTFS_ENCFN_USE_MOUNT_FNEK))
|| (mount_crypt_stat
 (mount_crypt_stat-flags
-ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK)))
+ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK))) {
(*encoded_name_size) =
(ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE
 + encoded_name_no_prefix_size);
+   flag = true;
+   }
else
(*encoded_name_size) =
(ECRYPTFS_FEK_ENCRYPTED_FILENAME_PREFIX_SIZE
@@ -2131,11 +2134,7 @@ int ecryptfs_encrypt_and_encode_filename(
kfree(filename);
goto out;
}
-   if ((crypt_stat  (crypt_stat-flags
-ECRYPTFS_ENCFN_USE_MOUNT_FNEK))
-   || (mount_crypt_stat
-(mount_crypt_stat-flags
-ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK))) {
+   if (flag) {
memcpy((*encoded_name),
   ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX,
   ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND PATCH] fs/super.c set_anon_super calling optimization

2012-10-26 Thread Abhijit Pawar

On 10/26/2012 06:44 PM, Carlos Maiolino wrote:

Hi,

On Thu, Oct 25, 2012 at 05:08:19PM +0530, Abhijit Pawar wrote:

Hi,
set_anon_super is called by many filesystems. Some call directly and
some call through the wrapper. Many of them in the wrapper's call to
this function are passing the second argument to this function which
is not used anywhere.

This patch replaces the second variable with NULL.



If the variable isn't used anymore, why don't just get rid of it, instead of
call the function passing a NULL pointer on it?
At the moment its a callback function with two params so that 
filesystems are free to override it while mounting. This is to support 
filesystem specific information at mount time.


nfs uses it to get its server specific information. btrfs uses it to 
populate its filesystem information. So the signature can not be changed 
without affecting these filesystems.


sysfs, ceph, 9p will also be affected if we are to change the signature.






--
-
Abhijit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND PATCH] fs/super.c set_anon_super calling optimization

2012-10-26 Thread Abhijit Pawar

On 10/26/2012 06:44 PM, Carlos Maiolino wrote:

Hi,

On Thu, Oct 25, 2012 at 05:08:19PM +0530, Abhijit Pawar wrote:

Hi,
set_anon_super is called by many filesystems. Some call directly and
some call through the wrapper. Many of them in the wrapper's call to
this function are passing the second argument to this function which
is not used anywhere.

This patch replaces the second variable with NULL.



If the variable isn't used anymore, why don't just get rid of it, instead of
call the function passing a NULL pointer on it?
At the moment its a callback function with two params so that 
filesystems are free to override it while mounting. This is to support 
filesystem specific information at mount time.


nfs uses it to get its server specific information. btrfs uses it to 
populate its filesystem information. So the signature can not be changed 
without affecting these filesystems.


sysfs, ceph, 9p will also be affected if we are to change the signature.






--
-
Abhijit
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND PATCH] fs/super.c set_anon_super calling optimization

2012-10-25 Thread Abhijit Pawar

Hi,
set_anon_super is called by many filesystems. Some call directly and 
some call through the wrapper. Many of them in the wrapper's call to 
this function are passing the second argument to this function which is 
not used anywhere.


This patch replaces the second variable with NULL.

Thanks,
Abhijit Pawar

Signed-off-by: Abhijit Pawar 
CC: Greg Kroah-Hartman 
CC: linux-kernel@vger.kernel.org
CC: linux-bt...@vger.kernel.org

---

diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 137d503..132db90 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -61,7 +61,7 @@ static const struct super_operations v9fs_super_ops,
v9fs_super_ops_dotl;
static int v9fs_set_super(struct super_block *s, void *data)
{
s->s_fs_info = data;
-   return set_anon_super(s, data);
+   return set_anon_super(s, NULL);
}

/**
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 915ac14..c9994a3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -954,7 +954,7 @@ static int btrfs_test_super(struct super_block *s, void
*data)

static int btrfs_set_super(struct super_block *s, void *data)
{
-   int err = set_anon_super(s, data);
+   int err = set_anon_super(s, NULL);
if (!err)
s->s_fs_info = data;
return err;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index e831bce..486bf7a 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2260,7 +2260,7 @@ static int nfs_set_super(struct super_block *s, void
*data)
s->s_flags = sb_mntdata->mntflags;
s->s_fs_info = server;
s->s_d_op = server->nfs_client->rpc_ops->dentry_ops;
-   ret = set_anon_super(s, server);
+   ret = set_anon_super(s, NULL);
if (ret == 0)
server->s_dev = s->s_dev;
return ret;
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 71eb7e2..56d0059 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -89,7 +89,7 @@ static int sysfs_test_super(struct super_block *sb, void
*data)
static int sysfs_set_super(struct super_block *sb, void *data)
{
int error;
-   error = set_anon_super(sb, data);
+   error = set_anon_super(sb, NULL);
if (!error)
sb->s_fs_info = data;
return error;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND PATCH] fs/super.c set_anon_super calling optimization

2012-10-25 Thread Abhijit Pawar

Hi,
set_anon_super is called by many filesystems. Some call directly and 
some call through the wrapper. Many of them in the wrapper's call to 
this function are passing the second argument to this function which is 
not used anywhere.


This patch replaces the second variable with NULL.

Thanks,
Abhijit Pawar

Signed-off-by: Abhijit Pawar abhi.c.pa...@gmail.com
CC: Greg Kroah-Hartman gre...@linuxfoundation.org
CC: linux-kernel@vger.kernel.org
CC: linux-bt...@vger.kernel.org

---

diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 137d503..132db90 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -61,7 +61,7 @@ static const struct super_operations v9fs_super_ops,
v9fs_super_ops_dotl;
static int v9fs_set_super(struct super_block *s, void *data)
{
s-s_fs_info = data;
-   return set_anon_super(s, data);
+   return set_anon_super(s, NULL);
}

/**
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 915ac14..c9994a3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -954,7 +954,7 @@ static int btrfs_test_super(struct super_block *s, void
*data)

static int btrfs_set_super(struct super_block *s, void *data)
{
-   int err = set_anon_super(s, data);
+   int err = set_anon_super(s, NULL);
if (!err)
s-s_fs_info = data;
return err;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index e831bce..486bf7a 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2260,7 +2260,7 @@ static int nfs_set_super(struct super_block *s, void
*data)
s-s_flags = sb_mntdata-mntflags;
s-s_fs_info = server;
s-s_d_op = server-nfs_client-rpc_ops-dentry_ops;
-   ret = set_anon_super(s, server);
+   ret = set_anon_super(s, NULL);
if (ret == 0)
server-s_dev = s-s_dev;
return ret;
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 71eb7e2..56d0059 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -89,7 +89,7 @@ static int sysfs_test_super(struct super_block *sb, void
*data)
static int sysfs_set_super(struct super_block *sb, void *data)
{
int error;
-   error = set_anon_super(sb, data);
+   error = set_anon_super(sb, NULL);
if (!error)
sb-s_fs_info = data;
return error;

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/