From patchwork Mon Jun 19 09:12:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 109854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2873048vqr; Mon, 19 Jun 2023 02:32:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42Vhx3vJmYjroVApVvrHD5h5TzgDWl7LxrNRHr0hvx/vVmx4p8IzIjbE6rwHJQY2XOeRms X-Received: by 2002:a17:902:f688:b0:1ac:8be5:8787 with SMTP id l8-20020a170902f68800b001ac8be58787mr5085361plg.21.1687167160384; Mon, 19 Jun 2023 02:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687167160; cv=none; d=google.com; s=arc-20160816; b=obiqw8pzw+MiCMehqGZWTtUcZtN3L9Q6jkyuXt0wcb4h/YSJHlxQKr4i2fsiEQlYEh EkGn8GtiozjVM+QwIpnqaZHiWKd41RSfVOrsIa9lpMv//7l+whRZz9VazREnTEkFF/C4 uggqCx0iZAsWWGDRTBDRWpR7vtz/OAE58Dae5TgVBZZStoQ947LJYlMk1dXIFs9rYBFG a3+hWPytiXvaMgA3XqL7FRJJdbbBx4Y0m7VSmG4tCvLls2sYnSlPUGPengu907sXI9oW /P8lwZIuaga98e8QgCUlYPWE9dThrXKilyxL5jWcGhC9olNV+5JmiseZG98JGOm0t7Aj ZebA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=+VIaGHEAMsS77amy4w2aMWBNS+kTc0Yx6SUw4EFYC2w=; b=VzUbk1yR9mJHIU/rFQ5p185ks7LgTjx8AMnamZHGpiJ3kt9xZ0um0A0nuMioxwI0gJ 8NDkGSeImx3anvSwvSlvGFh4WnOBADg7kvgXCwIVrVx8aUOXAxNsXK7K50mUoYobVKVN x/QflKjqA6gA/YkecZcsJX/cBQ+WLTWsKH3BBRrYfuG2/+u9NBFbLorKUbR5Sgpn+4XE 4FqXEPQ8uNYv7MxhFmrFli0L0cRiaxgmxmFlSzlU2BuPb+zY9R3k81E9ksR21W44yilF ObQi6dEh5AXTNRZTY/F/G5Ai4h5arcbaTtwjm1AwJOS6QZZwRJSzQqDVV69AcoJk4rZO +rMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QZNSuDHy; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p16-20020a170902e75000b001b3f2ba0917si13122058plf.108.2023.06.19.02.32.27; Mon, 19 Jun 2023 02:32:40 -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=@kernel.org header.s=k20201202 header.b=QZNSuDHy; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229471AbjFSJM0 (ORCPT + 99 others); Mon, 19 Jun 2023 05:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231179AbjFSJMY (ORCPT ); Mon, 19 Jun 2023 05:12:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62CB9E0 for ; Mon, 19 Jun 2023 02:12:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E21D860B09 for ; Mon, 19 Jun 2023 09:12:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B276C433C0; Mon, 19 Jun 2023 09:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687165942; bh=nncO+JSw+gBGPePnGvsYe6987xslG26sNKILTCu8PE4=; h=From:To:Cc:Subject:Date:From; b=QZNSuDHyR+NEwIyN6E2jYjgAtNB48IQjhFe8x2s3pxhMNGzSGmsNTXyPd2gykDoPL sBqVtHd4Z/33TJ/t2Oywi2StoIJZh68DINrmETA5ac33mNmEexDL32E0ftRnf5EMJ5 3AX4uY5OVTCtAmN03yHzRiske2zy1xLKdXxqcd/UvzXz+ftWba/cxbedupBamO18D9 ddf27cJwmnYPVdYVCUwEttD+7fcUCo2GvFcDDfQOph48Mf61PC+oax3Uf5IVNtaBqX xIu00ZRJ83gFTBcUxDHL8wwJbAjSLEV0A97jx/PiMes/nzOy7qSINMSMa8VmzA2trP /AnnttSR2STeA== From: Arnd Bergmann To: Edward Cree , Martin Habets , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Pieter Jansen van Vuuren Cc: Arnd Bergmann , Jiri Pirko , Alejandro Lucero , netdev@vger.kernel.org, linux-net-drivers@amd.com, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] [v2] sfc: add CONFIG_INET dependency for TC offload Date: Mon, 19 Jun 2023 11:12:09 +0200 Message-Id: <20230619091215.2731541-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769122992386666174?= X-GMAIL-MSGID: =?utf-8?q?1769122992386666174?= From: Arnd Bergmann The driver now fails to link when CONFIG_INET is disabled, so add an explicit Kconfig dependency: ld.lld: error: undefined symbol: ip_route_output_flow >>> referenced by tc_encap_actions.c >>> drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_flower_create_encap_md) in archive vmlinux.a ld.lld: error: undefined symbol: ip_send_check >>> referenced by tc_encap_actions.c >>> drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_gen_encap_header) in archive vmlinux.a >>> referenced by tc_encap_actions.c >>> drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_gen_encap_header) in archive vmlinux.a ld.lld: error: undefined symbol: arp_tbl >>> referenced by tc_encap_actions.c >>> drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_netevent_event) in archive vmlinux.a >>> referenced by tc_encap_actions.c >>> drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_netevent_event) in archive vmlinux.a Fixes: a1e82162af0b8 ("sfc: generate encap headers for TC offload") Reviewed-by: Edward Cree Reviewed-by: Simon Horman Closes: https://lore.kernel.org/oe-kbuild-all/202306151656.yttECVTP-lkp@intel.com/ Signed-off-by: Arnd Bergmann --- v2: add Fixes and Closes tags --- drivers/net/ethernet/sfc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig index 4af36ba8906ba..3eb55dcfa8a61 100644 --- a/drivers/net/ethernet/sfc/Kconfig +++ b/drivers/net/ethernet/sfc/Kconfig @@ -50,6 +50,7 @@ config SFC_MCDI_MON config SFC_SRIOV bool "Solarflare SFC9100-family SR-IOV support" depends on SFC && PCI_IOV + depends on INET default y help This enables support for the Single Root I/O Virtualization From patchwork Mon Jun 19 09:12:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 109851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2872544vqr; Mon, 19 Jun 2023 02:31:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4CJPo+W9tI4JjSp31agUnOpkGMZTlkXymQqCoubxGzOV+UChDRUYY4W8FWNDS4UDSbQema X-Received: by 2002:a17:903:124d:b0:1b0:3a74:7fc4 with SMTP id u13-20020a170903124d00b001b03a747fc4mr5908804plh.24.1687167082468; Mon, 19 Jun 2023 02:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687167082; cv=none; d=google.com; s=arc-20160816; b=IhRVz7gJ4XU35A7f4OpxcOoCqnrCslNTgzEDTNM1ls33PCqhEJ8edgVlZmkkTM0Kzj ZqpqdAZi18EIB0/wR3jC2dxJgNb8UPSHHvyHny8sZEsEsLLdcAr0Z/d8KcZ6r1yN/G8K aCn/Z9Zuwxz5+q8C409ty4upFI3EYvYROlRuVoio9RuzCu1vKLfgthSbZloAUkAjor2Y bHD62qxqTuXoLCWRz//Mq1vcVoNVJDVvx5RbGeVeHSiXWArr51XcH6UQMMTc7nKhnYi3 f4YuxNVYNe73nPWTdBgXlad5G9k/lC9mjcQBWFLD5NC1c8f37jy9wUajxB+DWgV1TMwd 2uZw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9RgSrqOXDzLzDu3AQNjJRuYFgjQDZpxUNMVaWhMCUos=; b=y4/nW7POD4XboYtUYaCRAItWc82JOXUZZYMTu7fO2VWyaXXQrWZR/A/5jcIV83yJoo HmdJtvNZ1hVAzSGUpSYIdgdKocRwRId+CktikBdwM9srLtdwiz/mipcFVkLR7Bl5TDJI uSp/+LDYKTF4uBKV1fW7VC1ui5dkpO7gdLUUMB8wPCXFLZw2TzOYaQy3VdB3FekL8dtd IK6MZZmwD5AVgM4oABgIh/zxm3YI6O489uIw/zeFiLI6AQzRiM1XRcPSW21iou4ZCFv2 MgHfYs9NsJY1ocX5HvnotiTkEuDwS4JHsaFFTacSRd8eZHiyn/gPwlCueDb27hkuGBsM m7Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EI4Wja3f; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a170903124b00b001a970d40828si7219720plh.603.2023.06.19.02.31.10; Mon, 19 Jun 2023 02:31: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=@kernel.org header.s=k20201202 header.b=EI4Wja3f; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbjFSJMk (ORCPT + 99 others); Mon, 19 Jun 2023 05:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231185AbjFSJMf (ORCPT ); Mon, 19 Jun 2023 05:12:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0E84CC for ; Mon, 19 Jun 2023 02:12:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5F30060AB1 for ; Mon, 19 Jun 2023 09:12:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36D1EC433C8; Mon, 19 Jun 2023 09:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687165952; bh=C9Nk9/QP6OPS4jxNq9hz3jeu3Lte1JDyc4vSyqZJLlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EI4Wja3flSrNux6FdpjGVJbrxdVm96gT6eM4VzNrbswJM0uodSDk5Ny98EBcrTPAX M+nJCf9Y4F2zYmbmZMFjWR5Ux53L2VGT8pN+U65LD9Qbec8/wLQcrXn5BY2CtpVZ1/ 7LRnas0WmzZJjvBIaOtxVE1XfMvucTnC1gxS56itWF8nnJr3YChTrmgs51sA45plAV EWvlI3oOmInYXr1EEkHJWQCtgQmUQqb54Hs1UMr1olj96m/e613rbUH+fL+wnoO5Yp 81NdcYmSMl36difwuNyajHwFZEq0UZirKi1sjoCOJyePipnlFGL348WmynOogkR6nw zZFlxlU4VoYbw== From: Arnd Bergmann To: Edward Cree , Martin Habets , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Pieter Jansen van Vuuren , Simon Horman Cc: Arnd Bergmann , netdev@vger.kernel.org, linux-net-drivers@amd.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] [v2] sfc: fix uninitialized variable use Date: Mon, 19 Jun 2023 11:12:10 +0200 Message-Id: <20230619091215.2731541-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619091215.2731541-1-arnd@kernel.org> References: <20230619091215.2731541-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769122910170516946?= X-GMAIL-MSGID: =?utf-8?q?1769122910170516946?= From: Arnd Bergmann The new efx_bind_neigh() function contains a broken code path when IPV6 is disabled: drivers/net/ethernet/sfc/tc_encap_actions.c:144:7: error: variable 'n' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (encap->type & EFX_ENCAP_FLAG_IPV6) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/sfc/tc_encap_actions.c:184:8: note: uninitialized use occurs here if (!n) { ^ drivers/net/ethernet/sfc/tc_encap_actions.c:144:3: note: remove the 'if' if its condition is always false if (encap->type & EFX_ENCAP_FLAG_IPV6) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/sfc/tc_encap_actions.c:141:22: note: initialize the variable 'n' to silence this warning struct neighbour *n; ^ = NULL Change it to use the existing error handling path here. Fixes: 7e5e7d800011a ("sfc: neighbour lookup for TC encap action offload") Suggested-by: Edward Cree Signed-off-by: Arnd Bergmann Reviewed-by: Edward Cree --- v2: use 'goto' instead of incorrectly entering another error path --- drivers/net/ethernet/sfc/tc_encap_actions.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/sfc/tc_encap_actions.c b/drivers/net/ethernet/sfc/tc_encap_actions.c index aac259528e73e..7e8bcdb222ad1 100644 --- a/drivers/net/ethernet/sfc/tc_encap_actions.c +++ b/drivers/net/ethernet/sfc/tc_encap_actions.c @@ -164,6 +164,7 @@ static int efx_bind_neigh(struct efx_nic *efx, */ rc = -EOPNOTSUPP; NL_SET_ERR_MSG_MOD(extack, "No IPv6 support (neigh bind)"); + goto out_free; #endif } else { rt = ip_route_output_key(net, &flow4); From patchwork Mon Jun 19 09:12:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 109842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2869702vqr; Mon, 19 Jun 2023 02:23:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4rY5uUt9LrLoPq9BkiZqhdUSDkz6wT9S28dq+5iBP1IoLwaK2kveCCFr/txH6+6PdoGJSm X-Received: by 2002:a17:902:d48b:b0:1b5:642e:139d with SMTP id c11-20020a170902d48b00b001b5642e139dmr2444935plg.10.1687166613365; Mon, 19 Jun 2023 02:23:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687166613; cv=none; d=google.com; s=arc-20160816; b=slaqnPa8cf0mGtmwb0arwC8xTT0u5/+ITsHlCClcrbRg3aMfw6YxeCSrxv73LwhC0F ykSn/+SWqxBBXtUC7VQ6F+2i6A6CVOFWXqW0kdvRAX+ytffrdVR1kmD+EEiRsx6mqdC3 DXfqbdPoBnxXr+07CQxDIXAIW/V1gYeE789VGovwlHgK7Jb3/XkCo7jmGO7xbMNVMI7p 3Pc4aOxMOG6qZmxZzJlb7ziGtNKJtcV4yWyT1kDpKeQDYH2IG1Xd96xGrUd7cTl/wrhK 2FWCvCKsdsceGo5O9W0wTkXXVZF6P8rzzRjpqY2rnrrkxVl0LL6qL2OIOa1UBZi4vwaL 5tyg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ImijP6fkgxXQpIWLLiEA2jzAwSFm/o2t17cgxp11D6s=; b=Zg0yO50QPEjCA5P7ef1FFzKcd669ay3k3JHUN76XBvwhPYh3CL2ZZImjPlWLsJfLQp 7M+DJNMbeREU3iUZMJXbCs89vw2iHYcanNIjvs8N6fJRJzLY2z+yjG6L4lTxfMAU7B8g pRaGaOATv5TxN0C/eIDtgkirS37a73fuUiFdgxDDDunjZJLymee/LMOP+suXZ1xFEJO2 99f/P3Zw4coo3D3rMjmBnLc5RluamrLbSwDgjl+Qfu5kXm7A/BHIymJtZNy5THX84kYB JBXBKwREzPM2hRojR9c8JO2VnwaHaofEvHQmLi8BKmq3QlOyEpJwGDGdAcTlGJbgH4tD RmCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VRznDpGm; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020a170902da8f00b001aaf7a9d7aasi16775159plx.126.2023.06.19.02.23.20; Mon, 19 Jun 2023 02:23:33 -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=@kernel.org header.s=k20201202 header.b=VRznDpGm; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbjFSJMw (ORCPT + 99 others); Mon, 19 Jun 2023 05:12:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231238AbjFSJMq (ORCPT ); Mon, 19 Jun 2023 05:12:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FB7110E for ; Mon, 19 Jun 2023 02:12:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE2BA60204 for ; Mon, 19 Jun 2023 09:12:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E9ABC433C0; Mon, 19 Jun 2023 09:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687165963; bh=qxfUKz7rm5GuWEeyfp0weQ2JFwovXXhOCgww3LgVweQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VRznDpGmTl7br3LipdSczF4mjvDiVoU4H2w2jIJzeS2NRj6AyAwmHlptSVRvcDNws MS/kogBoz3+GM69Yg/gzsaYVzgbvU3wj1NkYzX41lODZQyu4F9SGzuB+Al1FodFnMU /BMOQGUCPcpsjORuvNY6D3TpKkbsaBCWzNHN790KzY37Z4+qrDwsS4ixfn1G74C2qq uYVDCLqZQwTRZ2fWWOlQmZ3gf6rzj/tycq0H34Qom908ygXhnbKf/gePAR+LKkVD7p vSrcHmoTHx21hnmhZS81Ee1PBuGjDLa1bx/rJkkpJxsV8nIYTUmPxy7d+23reaTtUu S5g7ojolXdVnw== From: Arnd Bergmann To: Edward Cree , Martin Habets , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Arnd Bergmann , netdev@vger.kernel.org, linux-net-drivers@amd.com, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] sfc: selftest: fix struct packing Date: Mon, 19 Jun 2023 11:12:11 +0200 Message-Id: <20230619091215.2731541-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619091215.2731541-1-arnd@kernel.org> References: <20230619091215.2731541-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769122418567631335?= X-GMAIL-MSGID: =?utf-8?q?1769122418567631335?= From: Arnd Bergmann Three of the sfc drivers define a packed loopback_payload structure with an ethernet header followed by an IP header. However, the kernel definition of iphdr specifies that this is 4-byte aligned, causing a W=1 warning: net/ethernet/sfc/siena/selftest.c:46:15: error: field ip within 'struct efx_loopback_payload' is less aligned than 'struct iphdr' and is usually due to 'struct efx_loopback_payload' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] struct iphdr ip; As the iphdr packing is not easily changed without breaking other code, change the three structures to use a local definition instead. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/sfc/falcon/selftest.c | 21 ++++++++++++++++++++- drivers/net/ethernet/sfc/selftest.c | 21 ++++++++++++++++++++- drivers/net/ethernet/sfc/siena/selftest.c | 21 ++++++++++++++++++++- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/sfc/falcon/selftest.c b/drivers/net/ethernet/sfc/falcon/selftest.c index 6a454ac6f8763..fb7fcd27a33a5 100644 --- a/drivers/net/ethernet/sfc/falcon/selftest.c +++ b/drivers/net/ethernet/sfc/falcon/selftest.c @@ -40,7 +40,26 @@ */ struct ef4_loopback_payload { struct ethhdr header; - struct iphdr ip; + struct { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 ihl:4, + version:4; +#elif defined (__BIG_ENDIAN_BITFIELD) + __u8 version:4, + ihl:4; +#else +#error "Please fix " +#endif + __u8 tos; + __be16 tot_len; + __be16 id; + __be16 frag_off; + __u8 ttl; + __u8 protocol; + __sum16 check; + __be32 saddr; + __be32 daddr; + } __packed ip; /* unaligned struct iphdr */ struct udphdr udp; __be16 iteration; char msg[64]; diff --git a/drivers/net/ethernet/sfc/selftest.c b/drivers/net/ethernet/sfc/selftest.c index 3c5227afd4977..440a57953779c 100644 --- a/drivers/net/ethernet/sfc/selftest.c +++ b/drivers/net/ethernet/sfc/selftest.c @@ -43,7 +43,26 @@ */ struct efx_loopback_payload { struct ethhdr header; - struct iphdr ip; + struct { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 ihl:4, + version:4; +#elif defined (__BIG_ENDIAN_BITFIELD) + __u8 version:4, + ihl:4; +#else +#error "Please fix " +#endif + __u8 tos; + __be16 tot_len; + __be16 id; + __be16 frag_off; + __u8 ttl; + __u8 protocol; + __sum16 check; + __be32 saddr; + __be32 daddr; + } __packed ip; /* unaligned struct iphdr */ struct udphdr udp; __be16 iteration; char msg[64]; diff --git a/drivers/net/ethernet/sfc/siena/selftest.c b/drivers/net/ethernet/sfc/siena/selftest.c index 07715a3d6beab..b8a8b0495f661 100644 --- a/drivers/net/ethernet/sfc/siena/selftest.c +++ b/drivers/net/ethernet/sfc/siena/selftest.c @@ -43,7 +43,26 @@ */ struct efx_loopback_payload { struct ethhdr header; - struct iphdr ip; + struct { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 ihl:4, + version:4; +#elif defined (__BIG_ENDIAN_BITFIELD) + __u8 version:4, + ihl:4; +#else +#error "Please fix " +#endif + __u8 tos; + __be16 tot_len; + __be16 id; + __be16 frag_off; + __u8 ttl; + __u8 protocol; + __sum16 check; + __be32 saddr; + __be32 daddr; + } __packed ip; /* unaligned struct iphdr */ struct udphdr udp; __be16 iteration; char msg[64];