All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Zijie Zhao <zzjas98@gmail.com>
Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	netdev@vger.kernel.org, chenyuan0y@gmail.com
Subject: Re: [drivers/net/netdevsim] Question about possible memleak
Date: Thu, 14 Mar 2024 11:55:32 -0700	[thread overview]
Message-ID: <20240314115532.5ac9a177@kernel.org> (raw)
In-Reply-To: <ZfJdPoN7be+5ohpl@zijie-lab>

On Wed, 13 Mar 2024 21:13:18 -0500 Zijie Zhao wrote:
> Here if the `err_nsim_bus_dev_id_free` label is entered,
> `nsim_bus_dev` will be assigned `NULL` and then `kfree(nsim_bus_dev)`
> will not free the allocated memory.
> 
> Please kindly correct us if we missed any key information. Looking
> forward to your response!

/**
 * device_register - register a device with the system.
 * @dev: pointer to the device structure
 *
 * This happens in two clean steps - initialize the device
 * and add it to the system. The two steps can be called
 * separately, but this is the easiest and most common.
 * I.e. you should only call the two helpers separately if
 * have a clearly defined need to use and refcount the device
 * before it is added to the hierarchy.
 *
 * For more information, see the kerneldoc for device_initialize()
 * and device_add().
 *
 * NOTE: _Never_ directly free @dev after calling this function, even
 * if it returned an error! Always use put_device() to give up the
 * reference initialized in this function instead.
 */
int device_register(struct device *dev)

      reply	other threads:[~2024-03-14 18:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  2:13 [drivers/net/netdevsim] Question about possible memleak Zijie Zhao
2024-03-14 18:55 ` Jakub Kicinski [this message]

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=20240314115532.5ac9a177@kernel.org \
    --to=kuba@kernel.org \
    --cc=chenyuan0y@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zzjas98@gmail.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 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.