Re: [Samsung] bsg-lib.c patch for double-free error fix.
From: Jens Axboe
Date: Mon Jan 12 2026 - 10:36:24 EST
Please don't send patches as attachments, and particularly with html
emails as they will just get dropped from the list. And it makes it
impossible to reply to as well, as you then need to save and read the
patch separately and import it into an email...
> Change-Id: Iadb96f8736f8d9d9aae7b4a831c2a286ff59c520
What is this?
diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index 9ceb5d0832f5..635b3b988f92 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -215,7 +215,7 @@ static int bsg_map_buffer(struct bsg_buffer *buf, struct request *req)
BUG_ON(!req->nr_phys_segments);
- buf->sg_list = kmalloc(sz, GFP_KERNEL);
+ buf->sg_list = kzalloc(sz, GFP_KERNEL);
if (!buf->sg_list)
return -ENOMEM;
sg_init_table(buf->sg_list, req->nr_phys_segments);
How does this make a difference, when sg_init_table() explicitly sets it
all to 0?
--
Jens Axboe