[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGXu5jLAZ+SwToNx6vQqPkbZ_DjN5EuaPWWJJrNW59+EZwuK2Q@mail.gmail.com>
Date: Tue, 25 Jul 2017 14:06:34 -0700
From: Kees Cook <keescook@...omium.org>
To: "Tobin C. Harding" <me@...in.cc>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Seth Forshee <seth.forshee@...onical.com>,
Alexey Dobriyan <adobriyan@...il.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
kernel-janitors@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] proc: Remove cast from memory allocation
On Tue, Feb 21, 2017 at 10:42 PM, Tobin C. Harding <me@...in.cc> wrote:
> Coccinelle emits WARNING: casting value returned by memory allocation
> function to (struct proc_inode *) is useless.
>
> Remove unnecessary cast.
>
> Signed-off-by: Tobin C. Harding <me@...in.cc>
Acked-by: Kees Cook <keescook@...omium.org>
-Kees
> ---
> fs/proc/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/proc/inode.c b/fs/proc/inode.c
> index 842a5ff..1eb2326 100644
> --- a/fs/proc/inode.c
> +++ b/fs/proc/inode.c
> @@ -57,7 +57,7 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
> struct proc_inode *ei;
> struct inode *inode;
>
> - ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);
> + ei = kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);
> if (!ei)
> return NULL;
> ei->pid = NULL;
> --
> 2.7.4
>
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists