* [PATCH] fix alloc_cast.cocci warnings
2017-03-05 22:42 [cifs:for-next 1/1] fs/cifs/smb2misc.c:689:14-41: WARNING: casting value returned by memory allocation function to (struct close_cancelled_open *) is useless kbuild test robot
@ 2017-03-05 22:42 ` kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-03-05 22:42 UTC (permalink / raw)
To: Sachin Prabhu
Cc: kbuild-all, linux-cifs, samba-technical, Steve French,
Pavel Shilovsky, linux-kernel
fs/cifs/smb2misc.c:689:14-41: WARNING: casting value returned by memory allocation function to (struct close_cancelled_open *) is useless.
Remove casting the values returned by memory allocation functions
like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.
Semantic patch information:
This makes an effort to find cases of casting of values returned by
kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
the casting as it is not required. The result in the patch case may
need some reformatting.
Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci
CC: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
smb2misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -686,7 +686,7 @@ smb2_handle_cancelled_mid(char *buffer,
(sync_hdr->Status != STATUS_SUCCESS))
return 0;
- cancelled = (struct close_cancelled_open *)
+ cancelled =
kzalloc(sizeof(struct close_cancelled_open),
GFP_KERNEL);
if (!cancelled)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [cifs:for-next 1/1] fs/cifs/smb2misc.c:689:14-41: WARNING: casting value returned by memory allocation function to (struct close_cancelled_open *) is useless.
@ 2017-03-05 22:42 kbuild test robot
2017-03-05 22:42 ` [PATCH] fix alloc_cast.cocci warnings kbuild test robot
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2017-03-05 22:42 UTC (permalink / raw)
To: Sachin Prabhu
Cc: kbuild-all-JC7UmRfGjtg, linux-cifs-u79uwXL29TY76Z2rM5mHXA,
samba-technical-w/Ol4Ecudpl8XjKLYN78aQ, Steve French,
Pavel Shilovsky
tree: git://git.samba.org/sfrench/cifs-2.6.git for-next
head: ec1a4dc5ea28ca9cde4ba5c99447d5bc7929aaa9
commit: ec1a4dc5ea28ca9cde4ba5c99447d5bc7929aaa9 [1/1] Handle mismatched open calls
coccinelle warnings: (new ones prefixed by >>)
>> fs/cifs/smb2misc.c:689:14-41: WARNING: casting value returned by memory allocation function to (struct close_cancelled_open *) is useless.
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] fix alloc_cast.cocci warnings
2020-04-08 6:00 [jfern:rcu/dev 26/27] kernel/rcu/tree.c:3183:9-13: WARNING: casting value returned by memory allocation function to (void *) is useless kbuild test robot
@ 2020-04-08 6:00 ` kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-04-08 6:00 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2173 bytes --]
From: kbuild test robot <lkp@intel.com>
kernel/rcu/tree.c:3183:9-13: WARNING: casting value returned by memory allocation function to (void *) is useless.
kernel/rcu/tree.c:3196:9-13: WARNING: casting value returned by memory allocation function to (void *) is useless.
Remove casting the values returned by memory allocation functions
like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.
Semantic patch information:
This makes an effort to find cases of casting of values returned by
kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
the casting as it is not required. The result in the patch case may
need some reformatting.
Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci
Fixes: 8260ad7c243a ("[RFC] Refactor object allocation and try harder even for array allocation")
CC: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: kbuild test robot <lkp@intel.com>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git rcu/dev
head: 59c8c6df67765ffa1726cacb3cdb3021233566a7
commit: 8260ad7c243a4a9dfbdbb5ddb48a481a711de1fa [26/27] [RFC] Refactor object allocation and try harder even for array allocation
tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3180,7 +3180,7 @@ static inline void *alloc_object_locked(
* First, do an allocation without waiting.
*/
ptr = (size == PAGE_SIZE) ? (void *)__get_free_page(gfp_flags | GFP_NOWAIT)
- : (void *)kmalloc(size, gfp_flags | GFP_NOWAIT);
+ : kmalloc(size, gfp_flags | GFP_NOWAIT);
/* If we cannot sleep, we are done */
if (ptr || !can_sleep)
return ptr;
@@ -3193,7 +3193,7 @@ static inline void *alloc_object_locked(
*/
krc_this_cpu_unlock(krcp, NULL);
ptr = (size == PAGE_SIZE) ? (void *)__get_free_page(gfp_flags | GFP_KERNEL)
- : (void *)kmalloc(size, gfp_flags | GFP_KERNEL);
+ : kmalloc(size, gfp_flags | GFP_KERNEL);
/* Take it back. We may have got migrated here */
*krcpp = krc_this_cpu_lock(NULL);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-08 6:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-05 22:42 [cifs:for-next 1/1] fs/cifs/smb2misc.c:689:14-41: WARNING: casting value returned by memory allocation function to (struct close_cancelled_open *) is useless kbuild test robot
2017-03-05 22:42 ` [PATCH] fix alloc_cast.cocci warnings kbuild test robot
2020-04-08 6:00 [jfern:rcu/dev 26/27] kernel/rcu/tree.c:3183:9-13: WARNING: casting value returned by memory allocation function to (void *) is useless kbuild test robot
2020-04-08 6:00 ` [PATCH] fix alloc_cast.cocci warnings kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.