From patchwork Mon Sep 27 12:16:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 514679 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp3879757ejj; Mon, 27 Sep 2021 05:16:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4k1EZSLV94EHTse74E0is2EioYx8zoeTr/EGKG6Rhj1wSdKoObXv42ugkwuyk5FJ7dBLx X-Received: by 2002:a62:7f58:0:b0:44b:5ea6:9fb6 with SMTP id a85-20020a627f58000000b0044b5ea69fb6mr15326385pfd.19.1632745004614; Mon, 27 Sep 2021 05:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632745004; cv=none; d=google.com; s=arc-20160816; b=zIJW/jzkC7t+GgvmhX/Gfgtzn6+uaBuKNKhh4MYZUBbDdo7zmS0aSTGnOdXC56hBNi SyMp+wGeCm69dfcPyHL/U7IxqWTPFjyTUDZ/Pl+94YlfueBIEamT6tSus6Wag5k52uyb x2mCNyBMeHtMWtgPYwPGgTf2GoQxqkh+VRH6aq23qR5ienmYVgqggV1hSlv0RUdafu5C 38BvMWzOc2+S3dw1zqRxkabPEuAUy26/Nz7ii0soZ12/tMiJ45Baeo99LSqLvCNO5Cje RvrTtjIZnzglAD7kUZWkL5vTsU18NZHzIdQ82ZqMNsAVJ5S/WfHAIhcrhbq7eLjOo58y AdHw== 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=5Jy5bRJpysujveRAVH9nnlRGfmah6hmFSAkfU7w8W30=; b=RrCSbSjjGewnNhYncfO0t60+aL38pTN/w34YLerTX2VHt3u/s1Pce8xtpPjo53Xe2Y 66znYzzYNuEtNwrQOMCtXHrSLWX87VeT4wsbDJTtYvnmaI//APiBUaCae7ogaQvB06A/ l5tB+u5MRrDz9m7vd7lf+0BwYpIaTgVKW7R4VD36yLFz429g4HsWIlk/sXlz7t7SMahh yMUsFEgu2gT7s1slWkzehgR6ikwDmRQvDAjJOX7gUjEkQHVFIEbDfBrTrPHbwM9yJ+Si GHe2jXBh59xB8GE68zLz4NLcCiySvnr9qCajLjeS7NMgWkAwg2BEogUpDPMzuzDDg1nA /eCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jiflBaFm; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m22si12797611pgd.318.2021.09.27.05.16.44; Mon, 27 Sep 2021 05:16:44 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jiflBaFm; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S234269AbhI0MSU (ORCPT + 8 others); Mon, 27 Sep 2021 08:18:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:41544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234162AbhI0MRy (ORCPT ); Mon, 27 Sep 2021 08:17:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E18C61002; Mon, 27 Sep 2021 12:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632744975; bh=VLo/T7QE7PzxvCAvdD1Dx6SHSPfV7VXt+9sxJ8jwEdY=; h=From:To:Cc:Subject:Date:From; b=jiflBaFmGv0Wu3oK+iueZyRJ55VwwX9vyZeFt788/RY4FibsFj3Yfcniw3mRgn1P1 UPMUkcJ7N1KhwNeKeZHurdBjEnRW87BgiNbPsaUsjsQlQspNEOSkczWnKN9X/nx3TN KKPoLgkhTZIquV2ZWTSG4ICRDfSd4EE9f42ibgPrrICx684BTza2m3gefFvx64yFUT l71jotSFZ6RWl1Wm8tShtCYyU3FacgteXG2MF1G3Tb4kApaFsXxmGDEVTXp9FkMBqX hyaJe9mOfWyuDo931hyPKiSoNnTtBUI/yic3oyy2qZejhhXNt7skFkwjvZfH3CvIKr xV/d30/DIRj8A== From: Arnd Bergmann To: "David S. Miller" , Jakub Kicinski Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] cxgb: avoid open-coded offsetof() Date: Mon, 27 Sep 2021 14:16:04 +0200 Message-Id: <20210927121611.940046-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann clang-14 does not like the custom offsetof() macro in vsc7326: drivers/net/ethernet/chelsio/cxgb/vsc7326.c:597:3: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction] HW_STAT(RxUnicast, RxUnicastFramesOK), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/chelsio/cxgb/vsc7326.c:594:56: note: expanded from macro 'HW_STAT' { reg, (&((struct cmac_statistics *)NULL)->stat_name) - (u64 *)NULL } Rewrite this to use the version provided by the kernel. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/chelsio/cxgb/vsc7326.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.29.2 diff --git a/drivers/net/ethernet/chelsio/cxgb/vsc7326.c b/drivers/net/ethernet/chelsio/cxgb/vsc7326.c index 873c1c7b4ca0..a19284bdb80e 100644 --- a/drivers/net/ethernet/chelsio/cxgb/vsc7326.c +++ b/drivers/net/ethernet/chelsio/cxgb/vsc7326.c @@ -591,7 +591,7 @@ static void port_stats_update(struct cmac *mac) } hw_stats[] = { #define HW_STAT(reg, stat_name) \ - { reg, (&((struct cmac_statistics *)NULL)->stat_name) - (u64 *)NULL } + { reg, offsetof(struct cmac_statistics, stat_name) / sizeof(u64) } /* Rx stats */ HW_STAT(RxUnicast, RxUnicastFramesOK),