Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9278232rwp; Thu, 20 Jul 2023 02:20:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlH4evNDiSVVk3mZ1DimD1RlQ9C7Q8q/Tt/cTElHxTOkVvryAhlliGNoCugcunTlq5XLNWiI X-Received: by 2002:a17:903:441:b0:1b8:897a:b3be with SMTP id iw1-20020a170903044100b001b8897ab3bemr16675321plb.1.1689844822313; Thu, 20 Jul 2023 02:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689844822; cv=none; d=google.com; s=arc-20160816; b=QvnpQ4V1DrgFte0T09BfH499u5ti3c3AYYWTDvBs/EqCiosHCLIDyRkjE4LoxrMadg OlYMb9g2vak5RhzecU8phX5wirGSH54ks1FhnLUy2QZXg2MUv+DQ2IRUmlLQTfS3WBel fYQ73lstlCGWUi6oLszgJonAsloyXesHnKWwcgiB/olaBNSygvpHt2rwvNnQn+sOTnvj AY5i3LMmMuoDtpjyv+asK+lIFciGS3ERcVKbsUiuUaALpFexae5W8okCOs1pqd2Gkeom +aWjyZ0Wn3nIkPO5z5v0WSIqig+n8+gGGs6rvLspCjNzKdh5+HAyx8iP3yVJtt0jZvEj 9QDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=vd+lEU5Fl2TIPJ8xcsPnSNyWBBTcuOGxPgWz+JpFHhw=; fh=9H5Evn3Cl0O8DRjvZlEFE2liVJGvhozV5rroNr4GwvA=; b=h/qr6DrRJcWTESS1en67Q83uO2sPXC1Kx5vHe2jqOoRKnrxxpveNjiC9QCYJG8okLe QSbKeUibezNYPDubkv9pOQcIXI5++glg+iOs8BsEePPH0EfpVR1etzdJ9uIdgVQlSsCp EXhHgxH17fp1RoC6WIhEgXaW2lpGyAQIPj0gU2tm/8gMCRZONbfKuO5zeJ6BoZ5it5SO 98dC4zbPBmxiyMj4iirFtL5B5w1vwsQ2gThgVlTdlA2QGI8KPiRBgV/hQYXxZWSdW8XB hvzqpeutJbKVLFSpfhyS6GRA4djKIBGYriOhO+LjChEKuSOBYuQZyTYqfZW+IbSgls91 dwOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TZpvZBP8; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk6-20020a170903070600b001b8a8f7af21si494909plb.557.2023.07.20.02.20.10; Thu, 20 Jul 2023 02:20:22 -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=@bootlin.com header.s=gm1 header.b=TZpvZBP8; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbjGTI50 (ORCPT + 99 others); Thu, 20 Jul 2023 04:57:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbjGTIsn (ORCPT ); Thu, 20 Jul 2023 04:48:43 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96163268E; Thu, 20 Jul 2023 01:48:40 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 82B48E0008; Thu, 20 Jul 2023 08:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1689842919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vd+lEU5Fl2TIPJ8xcsPnSNyWBBTcuOGxPgWz+JpFHhw=; b=TZpvZBP8z4VFpjhk1aMn9VASAw7o2tzmqRsxhui1u5vEMZ+6NllUmhF29PK0aQqjn/ZeAM YaoqVo/39UESzDb9wSTsghpo+eRIK0i6PmKXfQvQvVLVRn8E06yQVCapKkV1IFdqxWv91R ZhmjrIlW6PldJw/yx32DvspNkDLKJD8yG+9wMa6TDURVYNUIdH65VYe/bAMd9GoFnxP4NN /KabCx1bF6RT0MVYrin7okunOVnUhF/1FLBUqLzCNLgw47w3aAoMJv1SCqe2P0cJtR6AIE F8c3FJcLHdIFAga4NUHLZVTAw7mTGpOQSD9lQDOir0CWAdYb+PnmFolWBFT0EA== Date: Thu, 20 Jul 2023 10:48:32 +0200 From: Miquel Raynal To: Tudor Ambarus Cc: Arnd Bergmann , Pratyush Yadav , Richard Weinberger , Vignesh Raghavendra , 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 Subject: Re: [PATCH] mtd: spi-nor: avoid holes in struct spi_mem_op Message-ID: <20230720104832.15a4d4ab@xps-13> In-Reply-To: <598bd9d8-249e-125c-bde3-7a63ba6dc5f7@linaro.org> References: <20230719190045.4007391-1-arnd@kernel.org> <598bd9d8-249e-125c-bde3-7a63ba6dc5f7@linaro.org> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 Hi Tudor, tudor.ambarus@linaro.org wrote on Thu, 20 Jul 2023 07:50:33 +0100: > On 7/19/23 20:00, Arnd Bergmann wrote: > > From: Arnd Bergmann > >=20 > > gcc gets confused when -ftrivial-auto-var-init=3Dpattern is used on spa= rse > > bit fields such as 'struct spi_mem_op', which caused the previous false > > positive warning about an uninitialized variable: > >=20 > > drivers/mtd/spi-nor/spansion.c: error: 'op' is used uninitialized [-Wer= ror=3Duninitialized] > >=20 > > 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. > >=20 > > A previous workaround added another initialization, which ended up > > shutting up the warning in spansion.c, though it apparently still happe= ns > > 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. > >=20 > > 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. > >=20 > > 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. > >=20 > > Cc: Peter Foley > > Cc: Pedro Falcato > > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110743 > > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108402 > > Link: https://godbolt.org/z/efMMsG1Kx > > Fixes: 420c4495b5e56 ("mtd: spi-nor: spansion: make sure local struct d= oes not contain garbage") > > Signed-off-by: Arnd Bergmann =20 >=20 > Acked-by: Tudor Ambarus >=20 > Miquel, would you please take this through mtd/fixes? I will! Thanks, Miqu=C3=A8l