提交 10d9dcf6 编写于 作者: K Kent Overstreet

bcache: Fix moving_pred()

Avoid a potential null pointer deref (e.g. from check keys for cache misses)
Signed-off-by: NKent Overstreet <kmo@daterainc.com>
上级 da415a09
...@@ -24,12 +24,10 @@ static bool moving_pred(struct keybuf *buf, struct bkey *k) ...@@ -24,12 +24,10 @@ static bool moving_pred(struct keybuf *buf, struct bkey *k)
moving_gc_keys); moving_gc_keys);
unsigned i; unsigned i;
for (i = 0; i < KEY_PTRS(k); i++) { for (i = 0; i < KEY_PTRS(k); i++)
struct bucket *g = PTR_BUCKET(c, k, i); if (ptr_available(c, k, i) &&
GC_MOVE(PTR_BUCKET(c, k, i)))
if (GC_MOVE(g))
return true; return true;
}
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册