[PATCH] x86/mca.c: malloc with correct pointer type

John Baldwin jhb at freebsd.org
Thu Mar 13 19:38:02 UTC 2014


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 at 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


More information about the freebsd-hackers mailing list