Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9219265rwp; Thu, 20 Jul 2023 01:07:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlFSC1MGuhMy33Qi/Eru5B6HaOu2gQk8jP5YrPt8UP+C/T9Df/Vn5Pv5FCH+eh5PvzLDbIua X-Received: by 2002:a05:6808:1392:b0:3a4:1b66:5494 with SMTP id c18-20020a056808139200b003a41b665494mr1249780oiw.44.1689840444726; Thu, 20 Jul 2023 01:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689840444; cv=none; d=google.com; s=arc-20160816; b=ZX+514S66iBLhaH93IT+IH2C1Rf/4YZsqTWBgZ7iSG4AqE5FoyXAuE9aQ7JRhaf5fI qVKENcNYi7cQgGsNmJNPDopVqfkKen/7MggI9H2O1KBlcCQ5KlucXbAqvkEqAMqfvTgI 5D5hTS6N9b4Yw5dcI6mjPy6JFU1nrcQjfmcocmXeu9fsVgTgM1YNK0ekb0Ndvn1tzkhd zYRD4/4O8AzZ66Xnpdm5kC7BP1OYDVsiMavpoFbHNXxmcGkvLRYqP8XKqbv+xJTGeA9w iBTF2a7FLJmQrEGNYfvJD/pgNWg/8GxbfkX/+Js7Ta+KSg1iEq4m6HLkpQaA2Mcb5Ynf qyzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=P0g/IBsPZGY5PxZfIKc7/6gIDE3jbSDKqZLxVCtbNmM=; fh=WICgIxlWMFVDwmBFGCbysoXLiFXWjTW4XHtKUfTE2gE=; b=uz1ZrZDk/pKjCMEFFqK8E9yc6XzQ3rIXd2agIzltI/GdvGCVLWcxryB0huDSgclDM2 kV7ej3F/H03YKl4j2yXgIq6qjF509RvmBDonHHleDEZUtIqjAFGl5I8FxUT+YVOQTmJO GQIrBekEjGFjar3kio5PoruW4mroxzKtJahacxRe9cwi6dwQjeiFoR0/clHvYKsFaCRA 9VfIDRE8VjjrAjOUGLmTf5bHuBKNAT2y7POKolq9TMhNlWZpJnoyeiVD9WXeD7nJNuHb zUNE9ELmC8AtJegpP+Z85XcAYSbbHq8iCovjpnGa9gVBi7Z44A7NiciiXHHHkDjX/+nj UZ9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Oie91okD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j23-20020a17090ae61700b002634977e6e7si612425pjy.102.2023.07.20.01.07.13; Thu, 20 Jul 2023 01:07:24 -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=@linaro.org header.s=google header.b=Oie91okD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229924AbjGTGun (ORCPT + 99 others); Thu, 20 Jul 2023 02:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbjGTGuk (ORCPT ); Thu, 20 Jul 2023 02:50:40 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327622121 for ; Wed, 19 Jul 2023 23:50:38 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-9922d6f003cso81893666b.0 for ; Wed, 19 Jul 2023 23:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689835836; x=1692427836; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=P0g/IBsPZGY5PxZfIKc7/6gIDE3jbSDKqZLxVCtbNmM=; b=Oie91okDf4TmQaL1csHvGo+xD5lYbjqxP+Y/+z633ZjSv+gZcB9UuUtkVx48D2RSKW IgISxlpeI2YmFSX8NauVibHdDy9iX4npnCgThkBlcEjqvjYX1/lRDXT4pvYnBxFtpQ8J ko5Z4m6YgZ729LTBXrAru3IXv4D13BpEiEQbjrx8ig1l9m/qTGqCwDB7enDhHsOTurBf mzLfr34aLHxiuytOFDb/LGWeBnGk07kvoyZAa57IOqpW5L2d9pkCIvsARkakeyWVXhmI x1sM8YYJKGf+eAPBzgEiQMB3J36zBRXXWhOMSr/vXpNT5vGTErpFOpOE28bjOouV6wH5 gx7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689835836; x=1692427836; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=P0g/IBsPZGY5PxZfIKc7/6gIDE3jbSDKqZLxVCtbNmM=; b=ZyUlV3BhudmsLMT9tYAmpDeeE+Ef66RDyPQY/FrbZ13zycz2VZ2pp3hpQBzhXg31F4 KugH4bP9niWo2/xMnR3FuOzvtBvoHESvfVKAQ/UzdWKvQm4Ug/1LZkuDUTTfAVRU864H soeDIU3RPJOSYpRv5lcrGnk7o203WEWYh0oDewqNm1U1bLYTIgKXj7GOKXjNsqc6sU8S 1FyvCBRUIpfQ5vm31W2ZWLvKP1xUggkIzSBXEMcWWqMmCnEpL9NgX5GBXFjGFvnlu15D t4uFxC33ktJF1tM/2bBYmjZZ4OLha9hdw/YEllAdFf/F+r4ZfdcTKA3lQt/sUxd4g1YL Se8A== X-Gm-Message-State: ABy/qLa1DiozYHmaUC/2rnSPo9ErKF41tsFJmA2cNGqwp9PJ02NTDe88 gmnZVFcALD3E6OAXM0VKa9JZPg== X-Received: by 2002:a17:907:779a:b0:99b:5689:1331 with SMTP id ky26-20020a170907779a00b0099b56891331mr575512ejc.59.1689835836589; Wed, 19 Jul 2023 23:50:36 -0700 (PDT) Received: from [192.168.0.107] ([79.115.63.16]) by smtp.gmail.com with ESMTPSA id o23-20020a1709062e9700b009935aba3a9dsm225434eji.48.2023.07.19.23.50.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Jul 2023 23:50:36 -0700 (PDT) Message-ID: <598bd9d8-249e-125c-bde3-7a63ba6dc5f7@linaro.org> Date: Thu, 20 Jul 2023 07:50:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] mtd: spi-nor: avoid holes in struct spi_mem_op Content-Language: en-US To: Arnd Bergmann , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Arnd Bergmann , Peter Foley , Pedro Falcato , Michael Walle , Mark Brown , Takahiro Kuwano , Dhruva Gole , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org References: <20230719190045.4007391-1-arnd@kernel.org> From: Tudor Ambarus In-Reply-To: <20230719190045.4007391-1-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 7/19/23 20:00, Arnd Bergmann wrote: > From: Arnd Bergmann > > gcc gets confused when -ftrivial-auto-var-init=pattern is used on sparse > bit fields such as 'struct spi_mem_op', which caused the previous false > positive warning about an uninitialized variable: > > drivers/mtd/spi-nor/spansion.c: error: 'op' is used uninitialized [-Werror=uninitialized] > > In fact, the variable is fully initialized and gcc does not see it being > used, so the warning is entirely bogus. The problem appears to be > a misoptimization in the initialization of single bit fields when the > rest of the bytes are not initialized. > > A previous workaround added another initialization, which ended up > shutting up the warning in spansion.c, though it apparently still happens > in other files as reported by Peter Foley in the gcc bugzilla. The > workaround of adding a fake initialization seems particularly bad > because it would set values that can never be correct but prevent the > compiler from warning about actually missing initializations. > > Revert the broken workaround and instead pad the structure to only > have bitfields that add up to full bytes, which should avoid this > behavior in all drivers. > > I also filed a new bug against gcc with what I found, so this can > hopefully be addressed in future gcc releases. At the moment, only > gcc-12 and gcc-13 are affected. > > Cc: Peter Foley > Cc: Pedro Falcato > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110743 > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108402 > Link: https://godbolt.org/z/efMMsG1Kx > Fixes: 420c4495b5e56 ("mtd: spi-nor: spansion: make sure local struct does not contain garbage") > Signed-off-by: Arnd Bergmann Acked-by: Tudor Ambarus Miquel, would you please take this through mtd/fixes? Cheers, ta