Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2934686ybk; Mon, 18 May 2020 11:29:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE1EBF2SrjMzBvlSAVhmjru/ye6J7CAc2+QIpGfB76BGKavhu/+yU7iYP2m7UE30Hdjx/b X-Received: by 2002:a17:906:eda3:: with SMTP id sa3mr15589226ejb.253.1589826547107; Mon, 18 May 2020 11:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589826547; cv=none; d=google.com; s=arc-20160816; b=RS+sY6QZTeRWPhjMVerIO96l4Iq4AwohPRv2F9HMMayIJ543QZaAbY9xJzozE86lB2 xbR71rWfS0fsPW1k+alDVIJeM+LKDdBbBb8JSuD1J7fjC8ked+bXzDa0fB1m/LjYyTkA OuB+yqPCNo5D8TmN9jNPXUl5fSsvZPj/5db3y9Ff3due8hUUEo6LUvXytPKb/FkW8ezY wXafr/33RXja1tpCwzh/WSLbe848L+ftJps0Jud9baxEoUeDj3hu6JPUn1zEAiKXjIDr uvl56tBR0ma7oSF/TPUnElAbzZmHXb1QSxDny0t2kja5gpUDub7MWu/ewZrdy8duJ870 68KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Om2PFEPypnqzSs8ZFoP5VvKu+Bww+gLKOiFWDO319XQ=; b=Zi0Gf5nvZhQq1iu/iYR14XNgiu7bLUDwLbtQGqg7BKTabeH6C+bN3qt3i3y275Uyek n6UsLGVRTyqhB94iIp8zH4TssN8iQ4vjxrUA9PA5Iu+rFC0SYkKfn3td3TA+ptqGiuRk L+0q+6l8pLB2Sz90danfLnjJprZFzc0tA/X64U9zNvJfctgIA1B+hWB51XKvcP/e8k5n vR64m+izo/rjskBz8inhTGZKVICBR6XKcv2JqkB7O52/R5rMjOB2cnST0QLDIIRpWnXz h83a61y+L2jc12oJAK19gorz5kp5MGz1Om+V0rht7PfyEQonsJLhp9EoFLuFdHx461Qu e37g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nrpqngwM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h11si7241200ejk.218.2020.05.18.11.28.42; Mon, 18 May 2020 11:29:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nrpqngwM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731953AbgERS0u (ORCPT + 99 others); Mon, 18 May 2020 14:26:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:43682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729847AbgERRpD (ORCPT ); Mon, 18 May 2020 13:45:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 592B620715; Mon, 18 May 2020 17:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589823902; bh=dfVQR4veVC0esrH3yIaUeif+5yaaxqOggWhhT+OkLVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nrpqngwMb10LhYtSce77MpW1M/KK10zC8Vqi5o9Ny0AtmLjA3t7gbKiGo+EdDr1GE MRcOeBjeUavqHnvuMi8OY4NywlUIHV+ynkSB0RmeHWDU6jArTVEsjhmsdEeIf55JDO wcPVCt10OcUhFlE2Je5olCbkDzykV1t76ha9IjxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds Subject: [PATCH 4.9 65/90] gcc-10: disable array-bounds warning for now Date: Mon, 18 May 2020 19:36:43 +0200 Message-Id: <20200518173504.341089242@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518173450.930655662@linuxfoundation.org> References: <20200518173450.930655662@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Torvalds commit 44720996e2d79e47d508b0abe99b931a726a3197 upstream. This is another fine warning, related to the 'zero-length-bounds' one, but hitting the same historical code in the kernel. Because C didn't historically support flexible array members, we have code that instead uses a one-sized array, the same way we have cases of zero-sized arrays. The one-sized arrays come from either not wanting to use the gcc zero-sized array extension, or from a slight convenience-feature, where particularly for strings, the size of the structure now includes the allocation for the final NUL character. So with a "char name[1];" at the end of a structure, you can do things like v = my_malloc(sizeof(struct vendor) + strlen(name)); and avoid the "+1" for the terminator. Yes, the modern way to do that is with a flexible array, and using 'offsetof()' instead of 'sizeof()', and adding the "+1" by hand. That also technically gets the size "more correct" in that it avoids any alignment (and thus padding) issues, but this is another long-term cleanup thing that will not happen for 5.7. So disable the warning for now, even though it's potentially quite useful. Having a slew of warnings that then hide more urgent new issues is not an improvement. Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- Makefile | 1 + 1 file changed, 1 insertion(+) --- a/Makefile +++ b/Makefile @@ -799,6 +799,7 @@ KBUILD_CFLAGS += $(call cc-disable-warni # We'll want to enable this eventually, but it's not going away for 5.7 at least KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds) +KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds) # Enabled with W=2, disabled by default as noisy KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)