nvme bug?? -- clearing extra memory
Kallol Biswas
kallol at nucleodyne.com
Wed Mar 31 20:39:42 BST 2021
Hi,
I have come across the following lines in the 5.8.0 nvme driver code.
drivers/nvme/host/pci.c
iod->sg = mempool_alloc(dev->iod_mempool, GFP_ATOMIC);
if (!iod->sg)
return BLK_STS_RESOURCE;
sg_init_table(iod->sg, blk_nr_phys_segments(req));
----------------------------------
void sg_init_table(struct scatterlist *sgl, unsigned int nents)
{
memset(sgl, 0, sizeof(*sgl) * nents);
.........................................
Question: mempool_alloc will allocate a single sg entry, and then if
blk_nr_phys_segmets() is > 1, then we will clear more memory area than
intended.
Is my understanding correct?
--
------
Kallol Biswas
Phone: 408-718-8164 (c)
Phone: 408-725-7527 (o)
NucleoDyne Systems, Inc.
More information about the Linux-nvme
mailing list