From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Eric Yun Lin Chiang <ericyunlinchiang@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Johan Hovold <johan@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
driver-core@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] devres: update node debug info on in-place devm_krealloc()
Date: Thu, 3 Dec 2026 13:42:35 +0200 [thread overview]
Message-ID: <axFVq1Fy8RH4T9wt@ashevche-desk.local> (raw)
In-Reply-To: <20261203005704.3066960-1-ericyunlinchiang@gmail.com>
On Thu, Dec 03, 2026 at 08:57:04AM +0800, Eric Yun Lin Chiang wrote:
> When the new size still fits in the existing allocation,
> devm_krealloc() returns the old pointer without touching the node's
> debug info, so the node keeps the size of the original request.
> devres_log() and the devres_log tracepoint then report a stale size
> for the resource: a buffer grown in place from 1000 to 1500 bytes, or
> shrunk to 600 bytes, is still reported as 1000 bytes.
Do we really support shrinking for realloc() in kernel?
I am under the impression that we don't, so in such a case info should
not be updated. Please, check this and confirm.
> Commit f813ec9e84b4 ("devres: fix missing node debug info in
> devm_krealloc()") added the debug info for nodes newly allocated by
> devm_krealloc(); do the same on the in-place path, so the recorded
> size always matches the size the caller asked for.
...
> /*
> * If new size is smaller or equal to the actual number of bytes
> - * allocated previously - just return the same pointer.
> + * allocated previously - just update the node's debug info and
> + * return the same pointer.
> */
> - if (total_new_size <= total_old_size)
> + if (total_new_size <= total_old_size) {
> + devres_set_node_dbginfo(&container_of(ptr, struct devres, data)->node,
> + "devm_krealloc_release", new_size);
> return ptr;
> + }
If I'm right, this patch is bogus.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-12-03 11:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 0:57 Eric Yun Lin Chiang
2026-12-03 11:42 ` Andy Shevchenko [this message]
2026-12-04 0:39 ` Eric Yun Lin Chiang
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=axFVq1Fy8RH4T9wt@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=ericyunlinchiang@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/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
all inboxes | Powered by JetHome®