Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jun 2015 21:39:19 +0200
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Sean Bruno <sbruno@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r284602 - head/sys/kern
Message-ID:  <20150619193919.GA24989@dft-labs.eu>
In-Reply-To: <201506191857.t5JIvbdP094203@svn.freebsd.org>
References:  <201506191857.t5JIvbdP094203@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jun 19, 2015 at 06:57:37PM +0000, Sean Bruno wrote:
> Author: sbruno
> Date: Fri Jun 19 18:57:36 2015
> New Revision: 284602
> URL: https://svnweb.freebsd.org/changeset/base/284602
> 
> Log:
>   Feedback from commit r284535
>   
>   davide:  imgact_binmisc_clear_entry() needs to use atomic ops to remove
>   the enable bit.
>   
>   kib:  M_NOWAIT is not warranted and comment is invalid.
> 
> Modified:
>   head/sys/kern/imgact_binmisc.c
> 
> Modified: head/sys/kern/imgact_binmisc.c
> ==============================================================================
> --- head/sys/kern/imgact_binmisc.c	Fri Jun 19 17:34:59 2015	(r284601)
> +++ head/sys/kern/imgact_binmisc.c	Fri Jun 19 18:57:36 2015	(r284602)
> @@ -317,7 +317,7 @@ imgact_binmisc_disable_entry(char *name)
>  		return (ENOENT);
>  	}
>  
> -	ibe->ibe_flags &= ~IBF_ENABLED;
> +	atomic_clear_32(&ibe->ibe_flags, IBF_ENABLED);
>  	sx_sunlock(&interp_list_sx);
>  
>  	return (0);
> @@ -406,8 +406,7 @@ imgact_binmisc_get_all_entries(struct sy
>  
>  	sx_slock(&interp_list_sx);
>  	count = interp_list_entry_count;
> -	/* Don't block in malloc() while holding lock. */
> -	xbe = malloc(sizeof(*xbe) * count, M_BINMISC, M_NOWAIT|M_ZERO);
> +	xbe = malloc(sizeof(*xbe) * count, M_BINMISC, M_ZERO);

You can't just remove M_NOWAIT. You have to put M_WAITOK in its place.
Once you do that, malloc cannot fail and null check below can be
removed.
>  	if (!xbe) {
>  		sx_sunlock(&interp_list_sx);
>  		return (ENOMEM);
> 

-- 
Mateusz Guzik <mjguzik gmail.com>



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