Skip to content

Commit

Permalink
Merge branch 'refs/heads/upstream-HEAD' into repo-HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Delphix Engineering committed Oct 6, 2024
2 parents 281eb59 + 4223d5d commit 625b60a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/kdumpfile/devmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ devmem_cleanup(struct kdump_shared *shared)
{
struct devmem_priv *dmp = shared->fmtdata;

if (!dmp)
return;

if (dmp->ce) {
free(dmp->ce[0].data);
free(dmp->ce);
Expand Down
13 changes: 6 additions & 7 deletions src/kdumpfile/diskdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,14 +1101,13 @@ open_common(kdump_ctx_t *ctx, void *hdr)
static void
init_desc(kdump_ctx_t *ctx, char *desc)
{
struct disk_dump_priv *ddp = ctx->shared->fmtdata;
unsigned fidx, nflat;

for (nflat = fidx = 0; fidx < ddp->num_files; ++fidx)
for (nflat = fidx = 0; fidx < get_num_files(ctx); ++fidx)
if (flatmap_isflattened(ctx->shared->flatmap, fidx))
++nflat;

if (nflat == ddp->num_files)
if (nflat == fidx)
strcpy(desc, "Flattened ");
else if (nflat)
strcpy(desc, "Mixed ");
Expand All @@ -1128,10 +1127,6 @@ diskdump_probe(kdump_ctx_t *ctx)
char desc[32];
kdump_status status;

status = init_private(ctx);
if (status != KDUMP_OK)
return status;

status = flatmap_pread(ctx->shared->flatmap, hdr, sizeof hdr, 0, 0);
if (status != KDUMP_OK)
return set_error(ctx, status, "Cannot read dump header");
Expand All @@ -1154,6 +1149,10 @@ diskdump_probe(kdump_ctx_t *ctx)
return set_error(ctx, status, "Cannot set %s",
"file.description");

status = init_private(ctx);
if (status != KDUMP_OK)
return status;

return open_common(ctx, hdr);
}

Expand Down
3 changes: 3 additions & 0 deletions src/kdumpfile/lkcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,9 @@ lkcd_cleanup(struct kdump_shared *shared)
{
struct lkcd_priv *lkcdp = shared->fmtdata;

if (!lkcdp)
return;

free_level1(lkcdp->pfn_level1, lkcdp->l1_size);
mutex_destroy(&lkcdp->pfn_block_mutex);
if (lkcdp->cbuf_slot >= 0)
Expand Down
2 changes: 2 additions & 0 deletions src/kdumpfile/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ open_dump(kdump_ctx_t *ctx)
ret = ctx->shared->ops->probe(ctx);
if (ret == KDUMP_OK)
return finish_open_dump(ctx);
if (ctx->shared->ops->cleanup)
ctx->shared->ops->cleanup(ctx->shared);
if (ret != KDUMP_NOPROBE)
return ret;

Expand Down

0 comments on commit 625b60a

Please sign in to comment.