git: 919cf790d4da - stable/12 - pf: consistently malloc rules with M_ZERO

Mateusz Guzik mjg at FreeBSD.org
Wed Aug 11 13:25:15 UTC 2021


The branch stable/12 has been updated by mjg:

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

commit 919cf790d4da75f82cae2c3dfc28a5d0f8e3d115
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-07-23 15:01:29 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-08-11 12:14:32 +0000

    pf: consistently malloc rules with M_ZERO
    
    Reviewed by:    kp
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 49a7d47235434a300cc57b205e493988fdebf79c)
---
 sys/netpfil/pf/pf_ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index ea323709f6cd..bb71f44cad97 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -2330,7 +2330,7 @@ DIOCADDRULENV_error:
 		struct pfioc_rule	*pr = (struct pfioc_rule *)addr;
 		struct pf_krule		*rule;
 
-		rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK);
+		rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK | M_ZERO);
 		error = pf_rule_to_krule(&pr->rule, rule);
 		if (error != 0) {
 			free(rule, M_PFRULE);
@@ -2583,7 +2583,7 @@ DIOCGETRULENV_error:
 		}
 
 		if (pcr->action != PF_CHANGE_REMOVE) {
-			newrule = malloc(sizeof(*newrule), M_PFRULE, M_WAITOK);
+			newrule = malloc(sizeof(*newrule), M_PFRULE, M_WAITOK | M_ZERO);
 			error = pf_rule_to_krule(&pcr->rule, newrule);
 			if (error != 0) {
 				free(newrule, M_PFRULE);


More information about the dev-commits-src-branches mailing list