The dm-integrity target didn't set the error string when memory
allocation failed. This patch fixes it.

Signed-off-by: Mikulas Patocka <[email protected]>
Cc: [email protected]

---
 drivers/md/dm-integrity.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-integrity.c    2025-02-05 18:44:43.000000000 
+0100
+++ linux-2.6/drivers/md/dm-integrity.c 2025-02-05 18:50:05.000000000 +0100
@@ -5081,16 +5081,19 @@ try_smaller_buffer:
 
                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;
                }


Reply via email to