From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:41192 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934090AbeAJM0U (ORCPT ); Wed, 10 Jan 2018 07:26:20 -0500 Date: Wed, 10 Jan 2018 13:16:33 +0100 From: Greg Kroah-Hartman To: Daniel Wagner Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org, Andrey Ryabinin , Johannes Berg , "David S. Miller" , Andrew Morton , Linus Torvalds Subject: Re: [PATCH 4.4] net/mac80211/debugfs.c: prevent build failure with CONFIG_UBSAN=y Message-ID: <20180110121632.GC12483@kroah.com> References: <20180109115327.22180-1-daniel.wagner@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180109115327.22180-1-daniel.wagner@siemens.com> Sender: stable-owner@vger.kernel.org List-ID: On Tue, Jan 09, 2018 at 12:53:27PM +0100, Daniel Wagner wrote: > From: Andrey Ryabinin > > commit 68920c973254c5b71a684645c5f6f82d6732c5d6 upstream. > > 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. > > Signed-off-by: Andrey Ryabinin > Cc: Johannes Berg > Cc: "David S. Miller" > Signed-off-by: Andrew Morton > Signed-off-by: Linus Torvalds > [Daniel: backport to 4.4.] > Signed-off-by: Daniel Wagner > --- > > Hi, > > The only stable tree which is missing this fix is 4.4. 4.1 doesn't > have 30686bf7f5b3 ("mac80211: convert HW flags to unsigned long > bitmap") which makes gcc unhappy with allmodconfig. 4.9 contains the > fix. Now queued up, thanks for the backport. greg k-h