git: 6e50988cf822 - main - netsmb: Stop checking for failures from malloc(M_WAITOK)

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Tue, 03 Sep 2024 10:26:52 UTC
The branch main has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=6e50988cf822f87a524b8da2fdc35b234078cc2f

commit 6e50988cf822f87a524b8da2fdc35b234078cc2f
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-09-03 10:25:20 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-09-03 10:25:20 +0000

    netsmb: Stop checking for failures from malloc(M_WAITOK)
    
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45852
---
 sys/netsmb/smb_rq.c   | 4 ----
 sys/netsmb/smb_subr.c | 2 --
 2 files changed, 6 deletions(-)

diff --git a/sys/netsmb/smb_rq.c b/sys/netsmb/smb_rq.c
index a33598489aa1..b2642f1aaa6d 100644
--- a/sys/netsmb/smb_rq.c
+++ b/sys/netsmb/smb_rq.c
@@ -64,8 +64,6 @@ smb_rq_alloc(struct smb_connobj *layer, u_char cmd, struct smb_cred *scred,
 	int error;
 
 	rqp = malloc(sizeof(*rqp), M_SMBRQ, M_WAITOK);
-	if (rqp == NULL)
-		return ENOMEM;
 	error = smb_rq_init(rqp, layer, cmd, scred);
 	rqp->sr_flags |= SMBR_ALLOCED;
 	if (error) {
@@ -376,8 +374,6 @@ smb_t2_alloc(struct smb_connobj *layer, u_short setup, struct smb_cred *scred,
 	int error;
 
 	t2p = malloc(sizeof(*t2p), M_SMBRQ, M_WAITOK);
-	if (t2p == NULL)
-		return ENOMEM;
 	error = smb_t2_init(t2p, layer, setup, scred);
 	t2p->t2_flags |= SMBT2_ALLOCED;
 	if (error) {
diff --git a/sys/netsmb/smb_subr.c b/sys/netsmb/smb_subr.c
index fbb951a37cef..68469cf5cc35 100644
--- a/sys/netsmb/smb_subr.c
+++ b/sys/netsmb/smb_subr.c
@@ -149,8 +149,6 @@ smb_memdup(const void *umem, int len)
 	if (len > 8 * 1024)
 		return NULL;
 	p = malloc(len, M_SMBSTR, M_WAITOK);
-	if (p == NULL)
-		return NULL;
 	bcopy(umem, p, len);
 	return p;
 }