Skip to contentSkip to conversation

cifsd: fix a IS_ERR() vs NULL bug

PATCH Superseded Dan Carpenter 1 participant 1 message Mar 18, 2021 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifsd: fix a IS_ERR() vs NULL bug

The smb_direct_alloc_sendmsg() function never returns NULL, it only returns error pointers so the check needs to be updated.

Fixes cabcebc31de4 ("cifsd: introduce SMB3 kernel server")
---
 fs/cifsd/transport_rdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifsd/transport_rdma.c +2 -2
index 1698f7ed9c2f..638b551019a1 100644
@@ -997,8 +997,8 @@ static int smb_direct_create_header(struct smb_direct_transport *t,
 	int ret;
 
 	sendmsg = smb_direct_alloc_sendmsg(t);
-	if (!sendmsg)
-		return -ENOMEM;
+	if (IS_ERR(sendmsg))
+		return PTR_ERR(sendmsg);
 
 	/* Fill in the packet header */
 	packet = (struct smb_direct_data_transfer *)sendmsg->packet;
Signature · 1 line
2.30.2