linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] io_uring: fix ifnullfree.cocci warnings
@ 2019-04-10  6:16 Julia Lawall
  2019-04-10  6:25 ` jianchao.wang
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2019-04-10  6:16 UTC (permalink / raw)
  To: Jianchao Wang
  Cc: axboe, viro, linux-block, linux-fsdevel, linux-kernel, kbuild-all

From: kbuild test robot <lkp@intel.com>

NULL check before kfree is not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: b905f31ee046 ("io_uring: introduce inline reqs for IORING_SETUP_IOPOLL")
CC: Jianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>

---

url:    https://github.com/0day-ci/linux/commits/Jianchao-Wang/io_uring-introduce-inline-reqs-for-IORING_SETUP_IOPOLL/20190409-194746
:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago

 io_uring.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2597,8 +2597,7 @@ static void io_ring_ctx_free(struct io_r
 		sock_release(ctx->ring_sock);
 #endif

-	if (ctx->inline_req_array)
-		kfree(ctx->inline_req_array);
+	kfree(ctx->inline_req_array);

 	io_mem_free(ctx->sq_ring);
 	io_mem_free(ctx->sq_sqes);

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

* Re: [PATCH] io_uring: fix ifnullfree.cocci warnings
  2019-04-10  6:16 [PATCH] io_uring: fix ifnullfree.cocci warnings Julia Lawall
@ 2019-04-10  6:25 ` jianchao.wang
  0 siblings, 0 replies; 2+ messages in thread
From: jianchao.wang @ 2019-04-10  6:25 UTC (permalink / raw)
  To: Julia Lawall
  Cc: axboe, viro, linux-block, linux-fsdevel, linux-kernel, kbuild-all



On 4/10/19 2:16 PM, Julia Lawall wrote:
> From: kbuild test robot <lkp@intel.com>
> 
> NULL check before kfree is not needed.
> 
> Generated by: scripts/coccinelle/free/ifnullfree.cocci
> 
> Fixes: b905f31ee046 ("io_uring: introduce inline reqs for IORING_SETUP_IOPOLL")
> CC: Jianchao Wang <jianchao.w.wang@oracle.com>
> Signed-off-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> 
> ---
> 
> url:    https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_0day-2Dci_linux_commits_Jianchao-2DWang_io-5Furing-2Dintroduce-2Dinline-2Dreqs-2Dfor-2DIORING-5FSETUP-5FIOPOLL_20190409-2D194746&d=DwIBAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=7WdAxUBeiTUTCy8v-7zXyr4qk7sx26ATvfo6QSTvZyQ&m=JhagBidUFU8krcGWek4GwnU4uoqS09eboyA8kslpNts&s=fcK4IjSBbR0XznBh7lL6V47NyfxmdixfO3QXiWWVuX0&e=
> :::::: branch date: 17 hours ago
> :::::: commit date: 17 hours ago
> 
>  io_uring.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2597,8 +2597,7 @@ static void io_ring_ctx_free(struct io_r
>  		sock_release(ctx->ring_sock);
>  #endif
> 
> -	if (ctx->inline_req_array)
> -		kfree(ctx->inline_req_array);
> +	kfree(ctx->inline_req_array);

Yes, indeed. kfree can tolerate NULL pointer.
Will change it in latter version.

Thanks
Jianchao

> 
>  	io_mem_free(ctx->sq_ring);
>  	io_mem_free(ctx->sq_sqes);
> 

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

end of thread, other threads:[~2019-04-10  6:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10  6:16 [PATCH] io_uring: fix ifnullfree.cocci warnings Julia Lawall
2019-04-10  6:25 ` jianchao.wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).