Skip to content

Commit

Permalink
dm-integrity: set ti->error on memory allocation failure
Browse files Browse the repository at this point in the history
The dm-integrity target didn't set the error string when memory
allocation failed. This patch fixes it.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
  • Loading branch information
Mikulas Patocka committed Feb 24, 2025
1 parent a8b8a12 commit 00204ae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/md/dm-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -5081,16 +5081,19 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv

ic->recalc_bitmap = dm_integrity_alloc_page_list(n_bitmap_pages);
if (!ic->recalc_bitmap) {
ti->error = "Could not allocate memory for bitmap";
r = -ENOMEM;
goto bad;
}
ic->may_write_bitmap = dm_integrity_alloc_page_list(n_bitmap_pages);
if (!ic->may_write_bitmap) {
ti->error = "Could not allocate memory for bitmap";
r = -ENOMEM;
goto bad;
}
ic->bbs = kvmalloc_array(ic->n_bitmap_blocks, sizeof(struct bitmap_block_status), GFP_KERNEL);
if (!ic->bbs) {
ti->error = "Could not allocate memory for bitmap";
r = -ENOMEM;
goto bad;
}
Expand Down

0 comments on commit 00204ae

Please sign in to comment.