From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 13 19:38:02 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA778CB2 for ; Thu, 13 Mar 2014 19:38:02 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A322468E for ; Thu, 13 Mar 2014 19:38:02 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C917DB94C; Thu, 13 Mar 2014 15:37:58 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Subject: Re: [PATCH] x86/mca.c: malloc with correct pointer type Date: Thu, 13 Mar 2014 13:57:07 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: <1394728529-22495-1-git-send-email-conrad.meyer@isilon.com> In-Reply-To: <1394728529-22495-1-git-send-email-conrad.meyer@isilon.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201403131357.07665.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 13 Mar 2014 15:37:58 -0400 (EDT) Cc: "Meyer, Conrad" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Mar 2014 19:38:02 -0000 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 > --- > > 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