X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=scripts%2Fkconfig%2Fmenu.c;h=fd3f0180e08fbafb537e128c9e46641288c68774;hb=87a777982c06e4af50a28fab4149ec08a95f80db;hp=b5c7d90df9df801dac0ca12d64b609e686e74b62;hpb=5c4b274981950049af3330f14ed9e9aa25afb2fb;p=firefly-linux-kernel-4.4.55.git diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index b5c7d90df9df..fd3f0180e08f 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -146,11 +146,24 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e struct menu *menu = current_entry; while ((menu = menu->parent) != NULL) { + struct expr *dup_expr; + if (!menu->visibility) continue; + /* + * Do not add a reference to the + * menu's visibility expression but + * use a copy of it. Otherwise the + * expression reduction functions + * will modify expressions that have + * multiple references which can + * cause unwanted side effects. + */ + dup_expr = expr_copy(menu->visibility); + prop->visible.expr = expr_alloc_and(prop->visible.expr, - menu->visibility); + dup_expr); } }