Re: [PATCH v2] blkparse: Fix a potential coredump issue
Jens Axboe <[email protected]> Wed, 19 Mar 2025 06:32:54 -0600
| Newsgroups | org.kernel.vger.linux-btrace |
|---|---|
| Message-ID | <[email protected]> |
> diff --git a/blkparse.c b/blkparse.c > index 9d2029a..2c459bc 100644 > --- a/blkparse.c > +++ b/blkparse.c > @@ -1023,6 +1023,7 @@ static struct io_track *find_track(struct per_dev_info *pdi, pid_t pid, > struct io_track_req *req; > > req = malloc(sizeof(*req) + sizeof(*iot)); > + memset(req, 0, sizeof(*req) + sizeof(*iot)); > req->ppm = find_ppm(pid); > if (!req->ppm) > req->ppm = add_ppm_hash(pid, "unknown"); > @@ -1107,6 +1108,7 @@ static void log_track_split(struct per_dev_info *pdi, struct blk_io_trace *t) > */ > iot = find_track(pdi, t->pid, t->sector); > split = malloc(sizeof(*iot)); > + memset(split, 0, sizeof(*iot)); > split->req = iot->req; > split->next = iot->next; > iot->next = split; Just use calloc() for these? -- Jens Axboe