Skip to contentSkip to conversation

nvmet-tcp: fix uninitialized variable access

PATCH New Sagi Grimberg 2 participants 2 messages Jan 9, 2019 – Jan 15, 2019

Subsystems (2)
lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvmet-tcp: fix uninitialized variable access

If we end up in nvmet_tcp_try_recv_one with a bogus state queue receive state we will access result which is uninitialized.

Initialize restult to 0 which will be considered as if no data was received by the tcp socket.

Fixes 872d26a391da ("nvmet-tcp: add NVMe over TCP target driver")
Reported-by Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/target/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/tcp.c +1 -1
index 44b37b202e39..ad0df786fe93 100644
@@ -1089,7 +1089,7 @@ static int nvmet_tcp_try_recv_ddgst(struct nvmet_tcp_queue *queue)
 
 static int nvmet_tcp_try_recv_one(struct nvmet_tcp_queue *queue)
 {
-	int result;
+	int result = 0;
 
 	if (unlikely(queue->rcv_state == NVMET_TCP_RECV_ERR))
 		return 0;
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw

PATCH 1/1 nvmet-tcp: fix uninitialized variable access

Thanks,

applied to nvme-5.0.