Skip to content

Commit

Permalink
dma: the passed io_func does not return NULL
Browse files Browse the repository at this point in the history
Initially found with the following semantic patch:

@ type @
BlockDriverAIOCB *x;
expression E;
@@
  x = E;
- if (x == NULL) { ... }

@ acb1 @
expression E, E1;
@@
  E1->acb = E;
- if (E1->acb == NULL) { ... }

@ aiocb1 @
expression E, E1;
@@
  E1->aiocb = E;
- if (E1->aiocb == NULL) { ... }

@ acb @
expression E, E1;
@@
  E1.acb = E;
- if (E1.acb == NULL) { ... }

@ aiocb @
expression E, E1;
@@
  E1.aiocb = E;
- if (E1.aiocb == NULL) { ... }

but changed manually to include an assert.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
bonzini authored and kevmw committed Dec 15, 2011
1 parent 91977c2 commit 6bee44e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions dma-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ static void dma_bdrv_cb(void *opaque, int ret)

dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov,
dbs->iov.size / 512, dma_bdrv_cb, dbs);
if (!dbs->acb) {
dma_complete(dbs, -EIO);
}
assert(dbs->acb);
}

static void dma_aio_cancel(BlockDriverAIOCB *acb)
Expand Down

0 comments on commit 6bee44e

Please sign in to comment.