Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753052AbbLCRGc (ORCPT ); Thu, 3 Dec 2015 12:06:32 -0500 Received: from s3.sipsolutions.net ([5.9.151.49]:33513 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751821AbbLCRGa (ORCPT ); Thu, 3 Dec 2015 12:06:30 -0500 Message-ID: <1449162322.31265.2.camel@sipsolutions.net> Subject: Re: [PATCH v4 2/3] mac80211: Prevent build failure with CONFIG_UBSAN=y From: Johannes Berg To: Andrey Ryabinin , linux-kernel@vger.kernel.org Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Andrew Morton , Peter Zijlstra , Sasha Levin , Randy Dunlap , Rasmus Villemoes , Jonathan Corbet , Michal Marek , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Yury Gribov , Dmitry Vyukov , Konstantin Khlebnikov , Kostya Serebryany , x86@kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org Date: Thu, 03 Dec 2015 18:05:22 +0100 In-Reply-To: <1449157807-20298-3-git-send-email-aryabinin@virtuozzo.com> References: <1449157807-20298-1-git-send-email-aryabinin@virtuozzo.com> <1449157807-20298-3-git-send-email-aryabinin@virtuozzo.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1258 Lines: 32 On Thu, 2015-12-03 at 18:50 +0300, Andrey Ryabinin wrote: > With upcoming CONFIG_UBSAN the following BUILD_BUG_ON in > net/mac80211/debugfs.c starts to trigger: > BUILD_BUG_ON(hw_flag_names[NUM_IEEE80211_HW_FLAGS] != (void > *)0x1); > > It seems, that compiler instrumentation causes some code > deoptimizations. > Because of that GCC is not being able to resolve condition in > BUILD_BUG_ON() > at compile time. > > We could make size of hw_flag_names array unspecified and replace the > condition in BUILD_BUG_ON() with following: > ARRAY_SIZE(hw_flag_names) != NUM_IEEE80211_HW_FLAGS > > That will have the same effect as before (adding new flag without > updating > array will trigger build failure) except it doesn't fail with > CONFIG_UBSAN. > As a bonus this patch slightly decreases size of hw_flag_names array. > Seems fine, would you want to take it through some other tree together with UBSAN, or do you expect that to still take long enough to allow this to trickle through our trees? johannes -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/