projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
da415a0
)
bcache: Fix moving_pred()
author
Kent Overstreet
<kmo@daterainc.com>
Mon, 17 Feb 2014 23:48:36 +0000
(15:48 -0800)
committer
Kent Overstreet
<kmo@daterainc.com>
Tue, 18 Mar 2014 19:22:34 +0000
(12:22 -0700)
Avoid a potential null pointer deref (e.g. from check keys for cache misses)
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
drivers/md/bcache/movinggc.c
patch
|
blob
|
history
diff --git
a/drivers/md/bcache/movinggc.c
b/drivers/md/bcache/movinggc.c
index 8c7205186d081edda0d09030f94753009768e0d0..5e8e58701d37ec45d494a0f7f336316f3428bfc2 100644
(file)
--- a/
drivers/md/bcache/movinggc.c
+++ b/
drivers/md/bcache/movinggc.c
@@
-24,12
+24,10
@@
static bool moving_pred(struct keybuf *buf, struct bkey *k)
moving_gc_keys);
unsigned i;
- for (i = 0; i < KEY_PTRS(k); i++) {
- struct bucket *g = PTR_BUCKET(c, k, i);
-
- if (GC_MOVE(g))
+ for (i = 0; i < KEY_PTRS(k); i++)
+ if (ptr_available(c, k, i) &&
+ GC_MOVE(PTR_BUCKET(c, k, i)))
return true;
- }
return false;
}