mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] proc:  Remove cast from memory allocation
@ 2017-02-22  6:42 Tobin C. Harding
  2017-07-25 21:06 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Tobin C. Harding @ 2017-02-22  6:42 UTC (permalink / raw)
  To: Andrew Morton, Seth Forshee
  Cc: Alexey Dobriyan, Eric W. Biederman, kernel-janitors,
	linux-kernel, Tobin C. Harding

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@tobin.cc>
---
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] proc: Remove cast from memory allocation
  2017-02-22  6:42 [PATCH] proc: Remove cast from memory allocation Tobin C. Harding
@ 2017-07-25 21:06 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2017-07-25 21:06 UTC (permalink / raw)
  To: Tobin C. Harding
  Cc: Andrew Morton, Seth Forshee, Alexey Dobriyan, Eric W. Biederman,
	kernel-janitors, LKML

On Tue, Feb 21, 2017 at 10:42 PM, Tobin C. Harding <me@tobin.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@tobin.cc>

Acked-by: Kees Cook <keescook@chromium.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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-25 21:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-22  6:42 [PATCH] proc: Remove cast from memory allocation Tobin C. Harding
2017-07-25 21:06 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®