Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp18282rdd; Wed, 22 Nov 2023 08:18:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFX5NRBNH7uPZnO2+Bu8ve3coIXPutg5E+/hui9EQeUe/Up269yPsFyO/vSzlNiOHq53VSA X-Received: by 2002:a17:90a:351:b0:280:200c:2e20 with SMTP id 17-20020a17090a035100b00280200c2e20mr2712938pjf.27.1700669934195; Wed, 22 Nov 2023 08:18:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700669934; cv=none; d=google.com; s=arc-20160816; b=KPacVFqy+UBr8sHYVwzVZu1G31Dctnq8VIHGRAXBWpq5vHNhdWwPJuekVYKhw8mzZ7 uAe/S8x0MEBbeRc2hTEvrjqSRfJZK3vL26fLZVleigVujUpIt8aIGm6c8sG3TP/CQLOm ddN+fC+9epkIXxXy1mLqHXnv4XX1SWWXKdFhhbPZJdEFxtcnuTbbRZ5zPWfEC4fkjDKI X70evqv5m2pN/b60RMEmEVVyQyW3Mpukkxfe4nQeGN3uySs3X7ZQUcnhNFvfgUQEU4EL Tc+H0ecP5GO0tQp4xM8bvdmBJo4uqS4EBqsww6nMFKuD9YlsB+OUoHNcy617ziHOyjL5 2/jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=HaNA+1kUhGp1TWlPIHpnCP3XDdAFKSdhNs80LYurPRo=; fh=yo2H+xsnXgV9mI72i0Z6xyXgZIZF76spJbG5+BjEL14=; b=ML77y3lEuO3H8PGDSjXWN/dQDYCPJZs1Pz1qL2Z9q8d43EsxJfODf1Yk4CW7dy0Gl/ D2xOowPmGGpprEo4N5WM4qNKaNCK4H/7NA9siOJe+S2/Tfg/dB3OfHChotRB436/wfFB 0mvORei0ZhTcfofVUX1IirRqC9mmc7wlGLxySm99SzONhuV3rgw7i26o2mUzpJRELyyW WnKi8xZK3HBlAMj5Al5+dprxxFmxZRvoAjezy7b8O/00lQsWOMOwU4S3RXOY+yARmVZ8 2eAt8Fdm1l/dMNKVP18mUr/Yff58QgqkezzsEBnC1mD5HwjTIciJEGfcc8T/Fcje+GM7 dccw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QRXIUJo8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q10-20020a17090aa00a00b002851cc0a3e9si1735560pjp.98.2023.11.22.08.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 08:18:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QRXIUJo8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 74AD78061B6E; Wed, 22 Nov 2023 08:16:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbjKVQP7 (ORCPT + 99 others); Wed, 22 Nov 2023 11:15:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230419AbjKVQP5 (ORCPT ); Wed, 22 Nov 2023 11:15:57 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE4B3A2 for ; Wed, 22 Nov 2023 08:15:52 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2c503dbe50dso88675391fa.1 for ; Wed, 22 Nov 2023 08:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700669751; x=1701274551; darn=vger.kernel.org; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=HaNA+1kUhGp1TWlPIHpnCP3XDdAFKSdhNs80LYurPRo=; b=QRXIUJo8DrPR0TPtZWj4zjpFYHvjJYmVPUc9c7CN1CMy8z5qb+uUVLar0Ssw6Dv5h7 Cmx9qfHAhhLjPBNHYVhWOHMecRSfcg9nLXIdGF1x1HZFFVcjW7H41GYZx0mEYjf4BaES 41HZKpD7w1b3jkiKnQFjJz7Q0/sXYaRG78d1v/xeZaNuLMawqzpiUwc6/BIAX2eij9ek N8Ke6iPdGFHZHgasMCT1CrAX42lOE9urcf+0bn+jbfTBZahHRgiKY5VZu1RZEthfJ1oK eLTdUnmLC057BUR001nDeD9ckKdIrAgFmNxsBwqYcYAPiz2auVPCYaehbve45lexCCGJ XAEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700669751; x=1701274551; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HaNA+1kUhGp1TWlPIHpnCP3XDdAFKSdhNs80LYurPRo=; b=s2VfRAej6IfSXB/Iux97VF4TOsBjxEw6zYmXW7rHn77+7ASRKFGJY3qvIAKYCEtgoc 2TYE+DunMByeQq0kWa1QSq6Sw4rAnfOVP+V50LNL2gBvgyv5qF0H2aMra50+WR6bdrPq ky0xGxqRwoTpacKyPhNWi6Tcz0g3L2+vZdR2AmejJEB3ujl2G0btQVDcX98e7f0+rCeO nhF8agmo3fI+hNfKnXkLT4FSKekKPCZDTw0gZIOtDBsD6Jg21zYAQyeP0AmihD5Nf2zf UosGjew6zPQDA7ahK4qip0NRr4TPvzZWCJTTuBo/VwzWTisWeXOtsIjAiEKCORxQF4IC OE0A== X-Gm-Message-State: AOJu0YzQKO//a3grKfznXzYUaTb6g7a5Q5X2GzW8x9GTs5eD8fOyHcuX /S9pLHzBIG92QbSxy5h9Bc4= X-Received: by 2002:a2e:3513:0:b0:2c7:b9b6:85ff with SMTP id z19-20020a2e3513000000b002c7b9b685ffmr1935778ljz.36.1700669750755; Wed, 22 Nov 2023 08:15:50 -0800 (PST) Received: from [192.168.1.122] (cpc159313-cmbg20-2-0-cust161.5-4.cable.virginm.net. [82.0.78.162]) by smtp.gmail.com with ESMTPSA id d1-20020a5d5381000000b0032f7f4d008dsm17543459wrv.20.2023.11.22.08.15.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Nov 2023 08:15:50 -0800 (PST) Subject: Re: drivers/net/ethernet/sfc/selftest.c:48:16: warning: field ip within 'struct efx_loopback_payload::(anonymous at drivers/net/ethernet/sfc/selftest.c:46:2)' is less aligned than 'struct iphdr' and is usually due to 'struct efx_loopback_payload::(anonymous a... To: kernel test robot Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Jakub Kicinski , Andy Moreton , Simon Horman References: <202311220537.geMTr31W-lkp@intel.com> From: Edward Cree Message-ID: <3f42dee6-a6e2-1b35-674f-309aae042ae7@gmail.com> Date: Wed, 22 Nov 2023 16:15:49 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202311220537.geMTr31W-lkp@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 08:16:09 -0800 (PST) On 21/11/2023 21:25, kernel test robot wrote: > Hi Edward, > > FYI, the error/warning still remains. As I've argued previously, this is a false positive / compiler bug, and there is no way to resolve it without making the code strictly worse. This: >>> drivers/net/ethernet/sfc/selftest.c:48:16: warning: field ip within 'struct efx_loopback_payload::(anonymous at drivers/net/ethernet/sfc/selftest.c:46:2)' is less aligned than 'struct iphdr' and is usually due to 'struct efx_loopback_payload::(anonymous at drivers/net/ethernet/sfc/selftest.c:46:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access] is complaining about alignment within an anonymous struct, which only ever appears embedded within a larger struct in a way which maintains the correct alignment. #ifdef RANT Indeed, the only way we even *could* create an unaligned access out of this code would be via a declaration like typeof(*(((struct efx_loopback_payload *)0)->packet)) bad; because *the struct is anonymous*. And if that happened, the bad declaration would be the place to warn, both because it's incredibly ugly and because it's the place that's actually wrong. The struct definition itself is entirely *fine*. The compiler should be able to detect that, and if it's not smart enough to do so then it shouldn't be trying to warn in the first place. Quoth Linus[1]: "And if the compiler isn't good enough to do it, then the compiler shouldn't be warning about something that it hasn't got a clue about." The anonymous struct has to be there so that we can placate the memcpy hardening, and it has to contain a struct iphdr at a 4n+2 offset because that's what shape the on-the-wire packet *is*. To avoid the warning we would need to lose __packed and memcpy all of the members in and out of the buffer individually to explicitly-calculated offsets, which is worse code. #endif Either fix the compiler to not warn, or fix your automation to ignore this instance of the warning. -ed [1]: https://yarchive.net/comp/linux/gcc.html#13