Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Sep 2024 05:08:03 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: f7bcf5725fee - stable/13 - altq: Stop checking for failures from malloc(M_WAITOK)
Message-ID:  <202409300508.48U5834P024145@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=f7bcf5725fee3b65be9c7ba9cb201b2e469ae504

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

    altq: Stop checking for failures from malloc(M_WAITOK)
    
    While here, prefer malloc(M_ZERO) over bzero().
    
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45852
    
    (cherry picked from commit 2a119886630bb5fe8283e20db5acb7c0cdba31c3)
    (cherry picked from commit 891fdd020a6826eb98d30284f78000e666f9a263)
---
 sys/net/altq/altq_subr.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c
index 8000691a7963..4e8e72fdf35c 100644
--- a/sys/net/altq/altq_subr.c
+++ b/sys/net/altq/altq_subr.c
@@ -1360,12 +1360,7 @@ acc_add_filter(classifier, filter, class, phandle)
 		return (EINVAL);
 #endif
 
-	afp = malloc(sizeof(struct acc_filter),
-	       M_DEVBUF, M_WAITOK);
-	if (afp == NULL)
-		return (ENOMEM);
-	bzero(afp, sizeof(struct acc_filter));
-
+	afp = malloc(sizeof(*afp), M_DEVBUF, M_WAITOK | M_ZERO);
 	afp->f_filter = *filter;
 	afp->f_class = class;
 



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