kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Zheng Bin <zhengbin13@huawei.com>,
	Navid Emamdoost <navid.emamdoost@gmail.com>,
	linux-block@vger.kernel.org
Cc: nbd@other.debian.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, Aditya Pakki <pakki001@umn.edu>,
	Navid Emamdoost <emamd001@umn.edu>, Kangjie Lu <kjlu@umn.edu>,
	Stephen McCamant <mccamant@cs.umn.edu>,
	Qiushi Wu <wu000273@umn.edu>, Jens Axboe <axboe@kernel.dk>,
	Josef Bacik <josef@toxicpanda.com>,
	Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>,
	Yi Zhang <yi.zhang@huawei.com>
Subject: Re: [PATCH v3] nbd: Fix memory leak in nbd_add_socket
Date: Mon, 22 Jun 2020 14:25:03 +0000	[thread overview]
Message-ID: <d53f66d0-a122-017c-3f4a-3947adc13fd8@web.de> (raw)
In-Reply-To: <20200622112001.105047-1-zhengbin13@huawei.com>

> When adding first socket to nbd, 

…

Can the term “network block device” matter for this change description?


> … A memory leak will occur
> then because the function "nbd_config_put" will free "config->socks" only
> when "config->num_connections" is not zero.

Will an additional imperative wording be helpful for the commit message?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=625d3449788f85569096780592549d0340e9c0c7#n151

Regards,
Markus


…
> +++ b/drivers/block/nbd.c
> @@ -1033,25 +1033,26 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
> +	if (!nsock) {
> +		err = -ENOMEM;
> +		goto put_socket;
>  	}
>  	return 0;
> +

I find that the exception handling can be improved a bit more
by adding another jump target.

+e_nomem:
+	err = -ENOMEM;


> +put_socket:
> +	sockfd_put(sock);
> +	return err;
>  }

Would you like to apply any further fine-tuning?

Regards,
Markus

           reply	other threads:[~2020-06-22 14:25 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20200622112001.105047-1-zhengbin13@huawei.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d53f66d0-a122-017c-3f4a-3947adc13fd8@web.de \
    --to=markus.elfring@web.de \
    --cc=axboe@kernel.dk \
    --cc=emamd001@umn.edu \
    --cc=josef@toxicpanda.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kjlu@umn.edu \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mccamant@cs.umn.edu \
    --cc=navid.emamdoost@gmail.com \
    --cc=nbd@other.debian.org \
    --cc=pakki001@umn.edu \
    --cc=tuomas.tynkkynen@iki.fi \
    --cc=wu000273@umn.edu \
    --cc=yi.zhang@huawei.com \
    --cc=zhengbin13@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).