Message ID | 20171108210959.16470-1-xypron.glpk@gmx.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
2017-11-09 6:09 GMT+09:00 Heinrich Schuchardt <xypron.glpk@gmx.de>: > 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 <xypron.glpk@gmx.de> > --- Applied to linux-kbuild. Thanks!
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 20136ffefb23..3c8bd9bb4267 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++)
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 <xypron.glpk@gmx.de> --- scripts/kconfig/symbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)