git: 5b00557330b3 - main - pf: Stop checking for failures from malloc(M_WAITOK)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 03 Sep 2024 10:26:51 UTC
The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=5b00557330b3b69db84969e33f2e201288208dd9 commit 5b00557330b3b69db84969e33f2e201288208dd9 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 pf: Stop checking for failures from malloc(M_WAITOK) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852 --- sys/netpfil/pf/pf_ioctl.c | 32 -------------------------------- sys/netpfil/pf/pf_syncookies.c | 3 --- 2 files changed, 35 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index d22ffc2245cb..64086bf08871 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2823,9 +2823,6 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td /* Copy the request in */ packed = malloc(nv->len, M_NVLIST, M_WAITOK); - if (packed == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, packed, nv->len); if (error) ERROUT(error); @@ -2903,9 +2900,6 @@ DIOCGETETHRULES_error: ERROUT(ENOMEM); nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error); @@ -3003,9 +2997,6 @@ DIOCGETETHRULE_error: ERROUT(ENOMEM); nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error); @@ -3036,8 +3027,6 @@ DIOCGETETHRULE_error: } rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); - if (rule == NULL) - ERROUT(ENOMEM); rule->timestamp = NULL; error = pf_nveth_rule_to_keth_rule(nvl, rule); @@ -3136,9 +3125,6 @@ DIOCADDETHRULE_error: ERROUT(ENOMEM); nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error); @@ -3214,9 +3200,6 @@ DIOCGETETHRULESETS_error: ERROUT(ENOMEM); nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error); @@ -3409,9 +3392,6 @@ DIOCADDRULENV_error: /* Copy the request in */ nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error); @@ -6003,9 +5983,6 @@ pf_keepcounters(struct pfioc_nv *nv) ERROUT(ENOMEM); nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error); @@ -6131,9 +6108,6 @@ pf_killstates_nv(struct pfioc_nv *nv) ERROUT(ENOMEM); nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error); @@ -6192,9 +6166,6 @@ pf_clearstates_nv(struct pfioc_nv *nv) ERROUT(ENOMEM); nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error); @@ -6253,9 +6224,6 @@ pf_getstate(struct pfioc_nv *nv) ERROUT(ENOMEM); nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - ERROUT(ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error); diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index c5ee64c6aed0..538ab1dfd94c 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -201,9 +201,6 @@ pf_set_syncookies(struct pfioc_nv *nv) return (ENOMEM); nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); - if (nvlpacked == NULL) - return (ENOMEM); - error = copyin(nv->data, nvlpacked, nv->len); if (error) ERROUT(error);