Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4969508iog; Wed, 22 Jun 2022 09:15:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uQ7B0EOfhmNrhLSipWI1scRvT4Te/M1osk9ICuKCu5OJQ/cqKACkfX7rYc0y5GWq8yJGbp X-Received: by 2002:a17:906:118:b0:715:771b:251b with SMTP id 24-20020a170906011800b00715771b251bmr3885547eje.651.1655914548545; Wed, 22 Jun 2022 09:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655914548; cv=none; d=google.com; s=arc-20160816; b=KICKqjmzD1qKSPPiUVz8HVVP751CeIrsVoICoyBjlAzX3tqpSEzNuh87VJ2HatXbIp yezZscaXhEYA2ZfE5RUsKCWcrrYIaFKBK/JeX65YAQPf7h6fhAYwf4H9n7zbiuaH3tYi icH0W39K4DZt3WbQ/+kjbN7NvmOONWx1QDNvRc3sNGfIAwuJ0nM9uW78OQzF4TK30vwE Fo06W8+y1z6BM0lbC4WDMDyPaSuFerysURZDQ/wps0fTQSZYI15GiGlQo0Fq+BvOb2qL j5gmi5g8BEfm9uXBfe9V9/w0VHPI7EhV+4264Mr2n6V1XfAKVxjcisMAbHbaImQA+uat 0WYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AplRqfnN0oWkS+2VNQi8ZStoPrmgxPvXHgqZuEE6ulA=; b=FLUB5iyDya7eWiPhJC21YqC+hvsAf9qixMegNT0PGV91J/kwF5kxqebecEqtcrONvr oRswqEWiQlVrN1j8onRnPejN8YBPUYalCWfxqwtjxioDXDAsB7yLSwShMBXuE4+xeNNA dzs9x7VRTtlBQnxGJKl6ueLflOycC8n8fmSsIAra4sqC7BAycQ2tNOknXVvF2D893NDX OGHFcoSF5JdBPEFoYz75ZaEG2VrYzeTRHiWNYJvQKYFQzwczsoeDzEoKTfd6NtKUQtnd A8SlfFe/BB//8SJ8ft8opjtGHR8FAaOKCVEXWiKHB6hbsqI1JUxmJIGxWkEKFXw+mKbF Z4Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RjrOyWJQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn2-20020a05640222e200b0042b635aefcfsi16047994edb.82.2022.06.22.09.15.18; Wed, 22 Jun 2022 09:15:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RjrOyWJQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358810AbiFVQIF (ORCPT + 99 others); Wed, 22 Jun 2022 12:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358136AbiFVQIC (ORCPT ); Wed, 22 Jun 2022 12:08:02 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B081915A26 for ; Wed, 22 Jun 2022 09:08:00 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id ay16so15922645ejb.6 for ; Wed, 22 Jun 2022 09:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AplRqfnN0oWkS+2VNQi8ZStoPrmgxPvXHgqZuEE6ulA=; b=RjrOyWJQLKFLoF69Y4cw8jPAZQd/5a73i8kXm9/eqxT4hqXK39Co8UGdIrRTlokSAF LdKTNyP83Rc4J+75iaPsPpCji4Sc36JQRHgHEvJyiTS7qBTq5n4ELSWPbP4ibEDb5vh+ WEgDhWOy38aHbqmCKRCMRkcgJB88OKHWthfFg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AplRqfnN0oWkS+2VNQi8ZStoPrmgxPvXHgqZuEE6ulA=; b=g8S3XgJNxNLvVsjg8T07aRGXpE53smmaufGPcrAknH7dMH8G+cb/OVe6IKAVyUpmFv pBqKtNHSNxvlalF6RT7VTw1j+xnU1IwQKMPhBWDJegDwSj3qRrlquYW7o0ow5Q9z9j1V lpi41Dlmf3Nkh0W41DefC4z4InRPMTGpMrsUaO3Z6saCXFHJ9GJaKvrq1MZjtIRrlWyg t1E6EFStSeds3f+K05EHkPEQF/qAv6Iyn6Kc5HbX0DhnNl/ClRNUqKyYINZwcabnpk40 h+mWrXqN2HetkqbfB0uA8odhGrqzsknbimQl5WudDOWb5zMTDi5/2FizoZXw+iQcad+j ZqaA== X-Gm-Message-State: AJIora96jAAn9ilngxjyL3YOu1ddxsg4jos37wCV3bK3yvDh+yZmvuTT M1vdUHecmcpIRioZnRoncmNMb6XkhDQXliX0 X-Received: by 2002:a17:906:a57:b0:718:bd7e:e45b with SMTP id x23-20020a1709060a5700b00718bd7ee45bmr3803061ejf.204.1655914079051; Wed, 22 Jun 2022 09:07:59 -0700 (PDT) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com. [209.85.221.52]) by smtp.gmail.com with ESMTPSA id lb3-20020a170907784300b00722e8827c53sm2240766ejc.208.2022.06.22.09.07.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jun 2022 09:07:58 -0700 (PDT) Received: by mail-wr1-f52.google.com with SMTP id w17so24071192wrg.7 for ; Wed, 22 Jun 2022 09:07:57 -0700 (PDT) X-Received: by 2002:a5d:48c1:0:b0:21a:3574:e70c with SMTP id p1-20020a5d48c1000000b0021a3574e70cmr3983380wrs.97.1655914076974; Wed, 22 Jun 2022 09:07:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Wed, 22 Jun 2022 11:07:40 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: mainline build failure due to 281d0c962752 ("fortify: Add Clang support") To: Sudip Mukherjee Cc: Nathan Chancellor , Kees Cook , Nick Desaulniers , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Netdev , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_RED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 22, 2022 at 11:00 AM Sudip Mukherjee wrote: > > imho, there is no check for 'i' and it can become more than MAX_FW_TYPE_NUM and > in that case it will overwrite. No. That's already checked a few lines before, in the if (fw_image->fw_info.fw_section_cnt > MAX_FW_TYPE_NUM) { .. error out path. And fw_section_cnt as a value is an unsigned bitfield of 16 bits, so there's no chance of some kind of integer signedness confusion. So clang is just wrong here. The fact that you can apparently silence the error with an extra bogus check does hopefully give clang people a clue about *where* clang is wrong, but it's not an acceptable workaround for the kernel. We don't write worse source code to make bad compilers happy. My "use a struct assignment" is more acceptable because at least then the source code doesn't get worse. It arguably should have been done that way the whole time, even if 'memcpy()' is the traditional C way of doing struct assignments (traditional as in "_really_ old traditional C"). Linus