From patchwork Thu Sep 20 17:22:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 10608275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B01146CB for ; Thu, 20 Sep 2018 17:24:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 985C42E283 for ; Thu, 20 Sep 2018 17:24:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B0782E29A; Thu, 20 Sep 2018 17:24:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FA582E283 for ; Thu, 20 Sep 2018 17:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388242AbeITXI0 (ORCPT ); Thu, 20 Sep 2018 19:08:26 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45614 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727476AbeITXIZ (ORCPT ); Thu, 20 Sep 2018 19:08:25 -0400 Received: by mail-wr1-f65.google.com with SMTP id 20-v6so10195428wrb.12; Thu, 20 Sep 2018 10:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MnTJefPcDnUjEexZ63YwvuA/ucBgN9alSs7ZSnkWlhg=; b=kyG8mo8+p3E7jf+6xlOwFJvKyHNsmY94KkGDK0ETcTSQtdy23Mcic7JODYSUPS6O4Z YdNBY82M40WiupXxE5vJ6kiM3VdTJB1HWi5tX/CVAMsOiTjWXDLBZFB7OKpt6RoWKMRH PLPc0eRIKGI4ZnBij01n0tbpYnnd7Wj2+NBss+Gi9yorw53kK3lxsXh3PV6L91N5p4/U 9fx3izf6XJ3ud062UAGCQXzK8aE4hYiJ74Vpqxg2fc3wK0eJiACCxzukVVB35nDRqhR6 ySr7Pz4pTQVtSeHI9PSPSFfVbDguFSm5IUggyEHZUuJmOYlAOWq/SRdqsbPonllKycCI bFuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MnTJefPcDnUjEexZ63YwvuA/ucBgN9alSs7ZSnkWlhg=; b=nFxERmkUuZ16JWj20c/6Uw2JiTzQxCLHighLgq6C1NMCq3lNT55DFT/DkPIjICZox9 M+vC0FjsSyUjGlHIRNW/rHRJ+mEumoYIYXlc1lBXLbWMPzKhd1RYPdYpznIwjiDr593H py2MZWzPda3o4JDzO0yDHSrOPFM54WkZ/rHkGbz25ojjZ5pJ0DL3S+FVXI+ZWLYC22fJ OYChXFngoCnv53Z2pZXfxzgNpEKMvh7Y99sl7krM9vm+XVcF+HBIoiW6Dlwpryat/EOZ lJVYEp+Gw+0qi1DKV0+9DJm5zNImh4aZmDkN0XroUXSol7ftOUuULA792WSu/gF+yYxP Xj4w== X-Gm-Message-State: APzg51CA8766KcoQkjNLcrkU/j4jPQUvZX/jFdOzw8C32bsPE8x+6uMi zTvBnE1z86M8pcmbjNuJSk4= X-Google-Smtp-Source: ANB0VdZyGjxq0fGXj6GT4VCfup6Xj7NZdcFTuXeYqkCEurXaYspOYS+t6mFFyuYf0ETFRwSfK5qyBA== X-Received: by 2002:adf:9f13:: with SMTP id l19-v6mr35348305wrf.206.1537464232875; Thu, 20 Sep 2018 10:23:52 -0700 (PDT) Received: from localhost.localdomain (62.83.35.8.dyn.user.ono.com. [62.83.35.8]) by smtp.gmail.com with ESMTPSA id q200-v6sm3466562wmd.2.2018.09.20.10.23.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 10:23:52 -0700 (PDT) From: Miguel Ojeda To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Andreas Dilger , Masahiro Yamada , Michal Marek , Steven Rostedt , Mauro Carvalho Chehab , Olof Johansson , Konstantin Ryabitsev , "David S . Miller" , Andrey Ryabinin , Kees Cook , Thomas Gleixner , Ingo Molnar , Paul Lawrence , Sandipan Das , Andrey Konovalov , David Woodhouse , Will Deacon , Philippe Ombredanne , Paul Burton , David Rientjes , Willy Tarreau , Martin Sebor , Christopher Li , Jonathan Corbet , Theodore Ts'o , Geert Uytterhoeven , Rasmus Villemoes , Joe Perches , Arnd Bergmann , Dominique Martinet , Stefan Agner , Luc Van Oostenryck , Nick Desaulniers , Andrew Morton , Linus Torvalds , linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org, linux-sparse@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH v5 13/15] Compiler Attributes: enable -Wstringop-truncation on W=1 (gcc >= 8) Date: Thu, 20 Sep 2018 19:22:59 +0200 Message-Id: <20180920172301.21868-14-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180920172301.21868-1-miguel.ojeda.sandonis@gmail.com> References: <20180920172301.21868-1-miguel.ojeda.sandonis@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 217c3e019675 ("disable stringop truncation warnings for now") disabled -Wstringop-truncation since it was too noisy. Having __nonstring available allows us to let GCC know that a string is not meant to be NUL-terminated, which helps suppressing some -Wstringop-truncation warnings. Note that using __nonstring actually triggers other warnings (-Wstringop-overflow, which is on by default) which may be real problems. Therefore, cleaning up -Wstringop-truncation warnings also buys us the ability to uncover further potential problems. To encourage the use of __nonstring, we put the warning back at W=1. In the future, if we end up with a fairly warning-free tree, we might want to enable it by default. Signed-off-by: Miguel Ojeda Reviewed-by: Nick Desaulniers Reviewed-by: Kees Cook --- scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 8d5357053f86..b8f36f5f43f2 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -29,6 +29,7 @@ warning-1 += $(call cc-option, -Wmissing-include-dirs) warning-1 += $(call cc-option, -Wunused-but-set-variable) warning-1 += $(call cc-option, -Wunused-const-variable) warning-1 += $(call cc-option, -Wpacked-not-aligned) +warning-1 += $(call cc-option, -Wstringop-truncation) warning-1 += $(call cc-disable-warning, missing-field-initializers) warning-1 += $(call cc-disable-warning, sign-compare)