Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 2014 13:57:07 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        "Meyer, Conrad" <conrad.meyer@isilon.com>
Subject:   Re: [PATCH] x86/mca.c: malloc with correct pointer type
Message-ID:  <201403131357.07665.jhb@freebsd.org>
In-Reply-To: <1394728529-22495-1-git-send-email-conrad.meyer@isilon.com>
References:  <1394728529-22495-1-git-send-email-conrad.meyer@isilon.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, March 13, 2014 12:35:34 pm Meyer, Conrad wrote:
> Another trivial one discovered by Clang.
> 
> Sponsored by: EMC/Isilon storage division
> Signed-off-by: Conrad Meyer <conrad.meyer@isilon.com>
> ---
> 
> Had to track down where this file lived in CURRENT, since we have it in an 
old
> location in OneFS.
> ---
>  sys/x86/x86/mca.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sys/x86/x86/mca.c b/sys/x86/x86/mca.c
> index 0e246ed..ac0b957 100644
> --- a/sys/x86/x86/mca.c
> +++ b/sys/x86/x86/mca.c
> @@ -700,8 +700,8 @@ cmci_setup(void)
>  {
>  	int i;
>  
> -	cmc_state = malloc((mp_maxid + 1) * sizeof(struct cmc_state **),
> -	    M_MCA, M_WAITOK);
> +	cmc_state = malloc((mp_maxid + 1) * sizeof(*cmc_state), M_MCA,
> +	    M_WAITOK);
>  	for (i = 0; i <= mp_maxid; i++)
>  		cmc_state[i] = malloc(sizeof(struct cmc_state) * mca_banks,
>  		    M_MCA, M_WAITOK | M_ZERO);

I would rather do 'struct cmc_state *' as I think it is clearer to read, but 
the change is correct.  Thanks!

-- 
John Baldwin



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