Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Sep 2024 05:08:05 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: be02b9a1142e - stable/13 - netsmb: Stop checking for failures from malloc(M_WAITOK)
Message-ID:  <202409300508.48U585fv024252@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by zlei:

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

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

    netsmb: Stop checking for failures from malloc(M_WAITOK)
    
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45852
    
    (cherry picked from commit 6e50988cf822f87a524b8da2fdc35b234078cc2f)
    (cherry picked from commit ce708880847cb8d87ac0d7499fdb6f08cc33a7f8)
---
 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 71f6e221ace9..0170514f52ce 100644
--- a/sys/netsmb/smb_rq.c
+++ b/sys/netsmb/smb_rq.c
@@ -65,8 +65,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) {
@@ -377,8 +375,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 8094f9593957..73961f7a8c81 100644
--- a/sys/netsmb/smb_subr.c
+++ b/sys/netsmb/smb_subr.c
@@ -150,8 +150,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;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202409300508.48U585fv024252>