2011-11-06 13:26:57

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 3/5] net/mac80211/debugfs.c: use kstrtoul, etc

From: Julia Lawall <[email protected]>

Use kstrtoul, etc instead of the now deprecated strict_strtoul, etc.

A semantic patch rule for the kstrtoul case is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression a,b;
{int,long} *c;
@@

-strict_strtoul
+kstrtoul
(a,b,c)
// </smpl>

Signed-off-by: Julia Lawall <[email protected]>

---
net/mac80211/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -190,7 +190,7 @@ static ssize_t uapsd_max_sp_len_write(st
return -EFAULT;
buf[len] = '\0';

- ret = strict_strtoul(buf, 0, &val);
+ ret = kstrtoul(buf, 0, &val);

if (ret)
return -EINVAL;



2011-11-07 12:10:54

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH 3/5] net/mac80211/debugfs.c: use kstrtoul, etc



On Mon, 7 Nov 2011, Eliad Peller wrote:

> On Sun, Nov 6, 2011 at 3:26 PM, Julia Lawall <[email protected]> wrote:
>> From: Julia Lawall <[email protected]>
>>
>> Use kstrtoul, etc instead of the now deprecated strict_strtoul, etc.
>>
>> A semantic patch rule for the kstrtoul case is as follows:
>> (http://coccinelle.lip6.fr/)
>>
>> // <smpl>
>> @@
>> expression a,b;
>> {int,long} *c;
>> @@
>>
>> -strict_strtoul
>> +kstrtoul
>> ?(a,b,c)
>> // </smpl>
>>
>> Signed-off-by: Julia Lawall <[email protected]>
>>
>> ---
>> ?net/mac80211/debugfs.c | ? ?2 +-
>> ?1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff -u -p a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
>> --- a/net/mac80211/debugfs.c
>> +++ b/net/mac80211/debugfs.c
>> @@ -190,7 +190,7 @@ static ssize_t uapsd_max_sp_len_write(st
>> ? ? ? ? ? ? ? ?return -EFAULT;
>> ? ? ? ?buf[len] = '\0';
>>
>> - ? ? ? ret = strict_strtoul(buf, 0, &val);
>> + ? ? ? ret = kstrtoul(buf, 0, &val);
>>
>> ? ? ? ?if (ret)
>> ? ? ? ? ? ? ? ?return -EINVAL;
>>
>
> maybe while cleaning it up change copy_from_user +
> strict_stroul/kstroul -> kstroul_from_user?

Thanks for the suggestion. I will look into it.

julia

2011-11-07 11:47:29

by Eliad Peller

[permalink] [raw]
Subject: Re: [PATCH 3/5] net/mac80211/debugfs.c: use kstrtoul, etc

On Sun, Nov 6, 2011 at 3:26 PM, Julia Lawall <[email protected]> wrote:
> From: Julia Lawall <[email protected]>
>
> Use kstrtoul, etc instead of the now deprecated strict_strtoul, etc.
>
> A semantic patch rule for the kstrtoul case is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression a,b;
> {int,long} *c;
> @@
>
> -strict_strtoul
> +kstrtoul
> ?(a,b,c)
> // </smpl>
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> ?net/mac80211/debugfs.c | ? ?2 +-
> ?1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff -u -p a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
> --- a/net/mac80211/debugfs.c
> +++ b/net/mac80211/debugfs.c
> @@ -190,7 +190,7 @@ static ssize_t uapsd_max_sp_len_write(st
> ? ? ? ? ? ? ? ?return -EFAULT;
> ? ? ? ?buf[len] = '\0';
>
> - ? ? ? ret = strict_strtoul(buf, 0, &val);
> + ? ? ? ret = kstrtoul(buf, 0, &val);
>
> ? ? ? ?if (ret)
> ? ? ? ? ? ? ? ?return -EINVAL;
>

maybe while cleaning it up change copy_from_user +
strict_stroul/kstroul -> kstroul_from_user?

Eliad.