소스 검색

[media] mantis: Fix error handling in mantis_dma_init()

Current code assigns 0 to variable 'err', which makes mantis_dma_init()
to return success even if mantis_alloc_buffers() fails.

Fix it by checking the return value from mantis_alloc_buffers() and
propagating it in the case of error.

Reported-by: RUC_Soft_Sec <zy900702@163.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Fabio Estevam 10 년 전
부모
커밋
02387b5f25
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      drivers/media/pci/mantis/mantis_dma.c

+ 3 - 2
drivers/media/pci/mantis/mantis_dma.c

@@ -130,10 +130,11 @@ err:
 
 
 int mantis_dma_init(struct mantis_pci *mantis)
 int mantis_dma_init(struct mantis_pci *mantis)
 {
 {
-	int err = 0;
+	int err;
 
 
 	dprintk(MANTIS_DEBUG, 1, "Mantis DMA init");
 	dprintk(MANTIS_DEBUG, 1, "Mantis DMA init");
-	if (mantis_alloc_buffers(mantis) < 0) {
+	err = mantis_alloc_buffers(mantis);
+	if (err < 0) {
 		dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer");
 		dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer");
 
 
 		/* Stop RISC Engine */
 		/* Stop RISC Engine */