Skip to contentSkip to conversation

media: vb2-dma-contig: fix sizeof(pointer) allocation

PATCH Alexey Dobriyan 2 participants 2 messages Jul 27, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

---

 drivers/media/v4l2-core/videobuf2-dma-contig.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/videobuf2-dma-contig.c +1 -1
@@ -749,7 +749,7 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_memops);
 int vb2_dma_contig_set_max_seg_size(struct device *dev, unsigned int size)
 {
 	if (!dev->dma_parms) {
-		dev->dma_parms = kzalloc(sizeof(dev->dma_parms), GFP_KERNEL);
+		dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
 		if (!dev->dma_parms)
 			return -ENOMEM;
 	}
#1 lore raw

Hi Alexey

Quoted 1 line · Alexey Dobriyan

A fix for this issue has been already queued:
https://patchwork.linuxtv.org/patch/35582/

Quoted 10 lines

---

  drivers/media/v4l2-core/videobuf2-dma-contig.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

drivers/media/v4l2-core/videobuf2-dma-contig.c EXPORT_SYMBOL_GPL(vb2_dma_contig_memops); · line 755

Quoted 8 lines
drivers/media/v4l2-core/videobuf2-dma-contig.c +1 -1
@@ -749,7 +749,7 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_memops);
  int vb2_dma_contig_set_max_seg_size(struct device *dev, unsigned int size)
  {
  	if (!dev->dma_parms) {
-		dev->dma_parms = kzalloc(sizeof(dev->dma_parms), GFP_KERNEL);
+		dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
  		if (!dev->dma_parms)
  			return -ENOMEM;
  	}

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland