From: Tom Rini Date: Wed, 8 Nov 2017 21:01:48 -0500 Subject: [U-Boot] [PATCH 1/1] kconfig/symbol.c: use correct pointer type argument for sizeof In-Reply-To: <20171108211354.16683-1-xypron.glpk@gmx.de> References: <20171108211354.16683-1-xypron.glpk@gmx.de> Message-ID: <20171109020148.GL27034@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Nov 08, 2017 at 10:13:54PM +0100, Heinrich Schuchardt wrote: > sym_arr is of type struct symbol **. > So in malloc we need sizeof(struct symbol *). > > The problem was indicated by coccinelle. > > Signed-off-by: Heinrich Schuchardt > --- > scripts/kconfig/symbol.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c > index 20136ffefb..3c8bd9bb42 100644 > --- a/scripts/kconfig/symbol.c > +++ b/scripts/kconfig/symbol.c > @@ -1061,7 +1061,7 @@ struct symbol **sym_re_search(const char *pattern) > } > if (sym_match_arr) { > qsort(sym_match_arr, cnt, sizeof(struct sym_match), sym_rel_comp); > - sym_arr = malloc((cnt+1) * sizeof(struct symbol)); > + sym_arr = malloc((cnt+1) * sizeof(struct symbol *)); > if (!sym_arr) > goto sym_re_search_free; > for (i = 0; i < cnt; i++) Since this comes right from the kernel, shouldn't it be fixed there too? Or is it already? Thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: