* [PATCH] megaraid: fix possible uninitialized-variable access in megadev_ioctl()
@ 2021-07-31 7:44 Tuo Li
0 siblings, 0 replies; only message in thread
From: Tuo Li @ 2021-07-31 7:44 UTC (permalink / raw)
To: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara, jejb,
martin.petersen
Cc: megaraidlinux.pdl, linux-scsi, linux-kernel, baijiaju1990,
Tuo Li, TOTE Robot
The variable pthru_dma_hndl is not initialized at the beginning of the
function megadev_ioctl(). It remains uninitialized if the variable
uioc.xferlen is zero at line 3275. However, it is accessed at line 3311:
mc.xferaddr = (u32)data_dma_hndl;
To fix this possible bug, pthru_dma_hndl is initialized to zero at the
beginning of the function megadev_ioctl().
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Tuo Li <islituo@gmail.com>
---
drivers/scsi/megaraid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 56910e94dbf2..8b0676b862fb 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2975,7 +2975,7 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
mega_passthru *pthru; /* copy user passthru here */
dma_addr_t pthru_dma_hndl;
void *data = NULL; /* data to be transferred */
- dma_addr_t data_dma_hndl; /* dma handle for data xfer area */
+ dma_addr_t data_dma_hndl = 0; /* dma handle for data xfer area */
megacmd_t mc;
#if MEGA_HAVE_STATS
megastat_t __user *ustats = NULL;
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-31 7:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31 7:44 [PATCH] megaraid: fix possible uninitialized-variable access in megadev_ioctl() Tuo Li
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.