2010-04-01 08:57:14

by Philipp Reisner

[permalink] [raw]
Subject: Re: [patch] drbd: potential null dereference

Hi Dan,

Thanks for the work with the static analyzer, but the patch is
bogus. The lc_element_by_index() function causes a BUG_ON before
returning a NULL. The next mail contains a patch that removes
the unnecessary conditional expression operator.

Philipp Reisner (1):
drbd: lc_element_by_index() never returns NULL

drivers/block/drbd/drbd_actlog.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)


2010-04-01 08:57:20

by Philipp Reisner

[permalink] [raw]
Subject: [PATCH] drbd: lc_element_by_index() never returns NULL

Signed-off-by: Philipp Reisner <[email protected]>
Signed-off-by: Lars Ellenberg <[email protected]>
---
drivers/block/drbd/drbd_actlog.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c
index 43e57f3..df01899 100644
--- a/drivers/block/drbd/drbd_actlog.c
+++ b/drivers/block/drbd/drbd_actlog.c
@@ -1336,7 +1336,7 @@ int drbd_rs_del_all(struct drbd_conf *mdev)
/* ok, ->resync is there. */
for (i = 0; i < mdev->resync->nr_elements; i++) {
e = lc_element_by_index(mdev->resync, i);
- bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL;
+ bm_ext = lc_entry(e, struct bm_extent, lce);
if (bm_ext->lce.lc_number == LC_FREE)
continue;
if (bm_ext->lce.lc_number == mdev->resync_wenr) {
--
1.6.3.3

2010-04-02 06:40:39

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] drbd: lc_element_by_index() never returns NULL

On Thu, Apr 01 2010, Philipp Reisner wrote:
> Signed-off-by: Philipp Reisner <[email protected]>
> Signed-off-by: Lars Ellenberg <[email protected]>

Applied

--
Jens Axboe