From patchwork Wed Oct 16 11:16:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 1177802 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=codethink.co.uk Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46tV9v11GGz9sCJ for ; Wed, 16 Oct 2019 22:16:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390947AbfJPLQu (ORCPT ); Wed, 16 Oct 2019 07:16:50 -0400 Received: from imap1.codethink.co.uk ([176.9.8.82]:48634 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389063AbfJPLQt (ORCPT ); Wed, 16 Oct 2019 07:16:49 -0400 Received: from [167.98.27.226] (helo=rainbowdash.codethink.co.uk) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1iKhIC-0005C7-Va; Wed, 16 Oct 2019 12:16:37 +0100 Received: from ben by rainbowdash.codethink.co.uk with local (Exim 4.92.2) (envelope-from ) id 1iKhIC-0005Eo-Fc; Wed, 16 Oct 2019 12:16:36 +0100 From: "Ben Dooks (Codethink)" To: linux-kernel@lists.codethink.co.uk Cc: "Ben Dooks (Codethink)" , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , "David S. Miller" , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: bpf: type fixes for __be16/__be32 Date: Wed, 16 Oct 2019 12:16:35 +0100 Message-Id: <20191016111635.20089-1-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org In bpf_skb_load_helper_8_no_cache and bpf_skb_load_helper_16_no_cache they read a u16/u32 where actually these are __be16 and __be32. Fix the following by making the types match: net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 Signed-off-by: Ben Dooks Acked-by: Martin KaFai Lau --- Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: "David S. Miller" Cc: netdev@vger.kernel.org Cc: bpf@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- net/core/filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index f7338fee41f8..eefb1545b4c6 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -205,7 +205,7 @@ BPF_CALL_2(bpf_skb_load_helper_8_no_cache, const struct sk_buff *, skb, BPF_CALL_4(bpf_skb_load_helper_16, const struct sk_buff *, skb, const void *, data, int, headlen, int, offset) { - u16 tmp, *ptr; + __be16 tmp, *ptr; const int len = sizeof(tmp); if (offset >= 0) { @@ -232,7 +232,7 @@ BPF_CALL_2(bpf_skb_load_helper_16_no_cache, const struct sk_buff *, skb, BPF_CALL_4(bpf_skb_load_helper_32, const struct sk_buff *, skb, const void *, data, int, headlen, int, offset) { - u32 tmp, *ptr; + __be32 tmp, *ptr; const int len = sizeof(tmp); if (likely(offset >= 0)) {