diff mbox series

security: tomoyo: Fix obsolete function

Message ID 1536050499-20889-1-git-send-email-dingxiang@cmss.chinamobile.com (mailing list archive)
State New, archived
Headers show
Series security: tomoyo: Fix obsolete function | expand

Commit Message

Ding Xiang Sept. 4, 2018, 8:41 a.m. UTC
simple_strtoul is obsolete, and use kstrtouint instead

Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
---
 security/tomoyo/common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tetsuo Handa Sept. 4, 2018, 10:22 a.m. UTC | #1
On 2018/09/04 17:41, Ding Xiang wrote:
> simple_strtoul is obsolete, and use kstrtouint instead
> 
> Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>

Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

> ---
>  security/tomoyo/common.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
> index 03923a1..9b38f94 100644
> --- a/security/tomoyo/common.c
> +++ b/security/tomoyo/common.c
> @@ -1660,7 +1660,8 @@ static void tomoyo_read_pid(struct tomoyo_io_buffer *head)
>  	head->r.eof = true;
>  	if (tomoyo_str_starts(&buf, "global-pid "))
>  		global_pid = true;
> -	pid = (unsigned int) simple_strtoul(buf, NULL, 10);
> +	if (kstrtouint(buf, 10, &pid))
> +		return;
>  	rcu_read_lock();
>  	if (global_pid)
>  		p = find_task_by_pid_ns(pid, &init_pid_ns);
>
James Morris Sept. 4, 2018, 6:57 p.m. UTC | #2
On Tue, 4 Sep 2018, Ding Xiang wrote:

> simple_strtoul is obsolete, and use kstrtouint instead
> 
> Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-general

and next-testing.
diff mbox series

Patch

diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 03923a1..9b38f94 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -1660,7 +1660,8 @@  static void tomoyo_read_pid(struct tomoyo_io_buffer *head)
 	head->r.eof = true;
 	if (tomoyo_str_starts(&buf, "global-pid "))
 		global_pid = true;
-	pid = (unsigned int) simple_strtoul(buf, NULL, 10);
+	if (kstrtouint(buf, 10, &pid))
+		return;
 	rcu_read_lock();
 	if (global_pid)
 		p = find_task_by_pid_ns(pid, &init_pid_ns);