From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: akpm@linux-foundation.org
Cc: kent.overstreet@linux.dev, bfoster@redhat.com,
irogers@google.com, linux-bcachefs@vger.kernel.org,
linux-kernel@vger.kernel.org, oe-kbuild-all@lists.linux.dev,
lkp@intel.com, Kuan-Wei Chiu <visitorckw@gmail.com>
Subject: [PATCH] bcachefs: Fix missing assignment of minimum element before min_heap_pop()
Date: Mon, 3 Jun 2024 01:48:28 +0800 [thread overview]
Message-ID: <20240602174828.1955320-1-visitorckw@gmail.com> (raw)
In-Reply-To: <202406030001.jwsq6DZp-lkp@intel.com>
When replacing the heap_pop() macro with min_heap_pop(), the original
heap_pop() macro would store the minimum element into 'ret'. However,
after replacing it with min_heap_pop(), the code incorrectly failed to
store the minimum element into 'ret' before deleting it.
Fix the issue by using min_heap_peek() to assign the minimum element to
'ret' before calling min_heap_pop() to remove the minimum element.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202406030001.jwsq6DZp-lkp@intel.com/
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
fs/bcachefs/clock.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/bcachefs/clock.c b/fs/bcachefs/clock.c
index 3ec64fe6a064..18fab9c44b1b 100644
--- a/fs/bcachefs/clock.c
+++ b/fs/bcachefs/clock.c
@@ -156,8 +156,10 @@ static struct io_timer *get_expired_timer(struct io_clock *clock,
spin_lock(&clock->timer_lock);
if (clock->timers.nr &&
- time_after_eq(now, clock->timers.data[0]->expire))
+ time_after_eq(now, clock->timers.data[0]->expire)) {
+ ret = *min_heap_peek(&clock->timers);
min_heap_pop(&clock->timers, &callbacks, NULL);
+ }
spin_unlock(&clock->timer_lock);
--
2.34.1
parent reply other threads:[~2024-06-02 17:48 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <202406030001.jwsq6DZp-lkp@intel.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=20240602174828.1955320-1-visitorckw@gmail.com \
--to=visitorckw@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bfoster@redhat.com \
--cc=irogers@google.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
/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®