Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Apr 2012 16:46:56 -0700
From:      Julian Elischer <julian@freebsd.org>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r233745 - head/sys/netinet/ipfw
Message-ID:  <4F7B8BF0.2000906@freebsd.org>
In-Reply-To: <201203311120.q2VBKmJT099513@svn.freebsd.org>
References:  <201203311120.q2VBKmJT099513@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3/31/12 4:20 AM, Gleb Smirnoff wrote:


Many years ago there was the possibility that malloc M_WAITOK could
return on shutdown or in some other rare error cases.

Are we certain this is no longer true?

> Author: glebius
> Date: Sat Mar 31 11:20:48 2012
> New Revision: 233745
> URL: http://svn.freebsd.org/changeset/base/233745
>
> Log:
>    Don't check malloc(M_WAITOK) results.
>
> Modified:
>    head/sys/netinet/ipfw/ip_fw_sockopt.c
>
> Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c
> ==============================================================================
> --- head/sys/netinet/ipfw/ip_fw_sockopt.c	Sat Mar 31 10:47:40 2012	(r233744)
> +++ head/sys/netinet/ipfw/ip_fw_sockopt.c	Sat Mar 31 11:20:48 2012	(r233745)
> @@ -163,8 +163,6 @@ ipfw_add_rule(struct ip_fw_chain *chain,
>
>   	l = RULESIZE(input_rule);
>   	rule = malloc(l, M_IPFW, M_WAITOK | M_ZERO);
> -	if (rule == NULL)
> -		return (ENOSPC);
>   	/* get_map returns with IPFW_UH_WLOCK if successful */
>   	map = get_map(chain, 1, 0 /* not locked */);
>   	if (map == NULL) {
> @@ -1010,8 +1008,6 @@ ipfw_ctl(struct sockopt *sopt)
>   			if (size>= sopt->sopt_valsize)
>   				break;
>   			buf = malloc(size, M_TEMP, M_WAITOK);
> -			if (buf == NULL)
> -				break;
>   			IPFW_UH_RLOCK(chain);
>   			/* check again how much space we need */
>   			want = chain->static_len + ipfw_dyn_len();
>
>




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