Message ID | 20170314212144.29988-4-david.daney@cavium.com |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show
Return-Path: <netdev-owner@vger.kernel.org> X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vjSP23DZyz9s1h for <patchwork-incoming@ozlabs.org>; Wed, 15 Mar 2017 08:22:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=CAVIUMNETWORKS.onmicrosoft.com header.i=@CAVIUMNETWORKS.onmicrosoft.com header.b="MnJ8cgzM"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753312AbdCNVWL (ORCPT <rfc822;patchwork-incoming@ozlabs.org>); Tue, 14 Mar 2017 17:22:11 -0400 Received: from mail-dm3nam03on0055.outbound.protection.outlook.com ([104.47.41.55]:28802 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753150AbdCNVWJ (ORCPT <rfc822;netdev@vger.kernel.org>); Tue, 14 Mar 2017 17:22:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vele+4qzo1X4g+xFLjYCnM0YU2AmeLDJ4TTuqYWWiJU=; b=MnJ8cgzMgskUcuLeNceRPc5IOjtyyfdbzFP8fpl830ELHCHWEi3BCUzI/cfe69baffEXnnRu9cBS7Dsj1Vd7CrHne7etGE4Bp8YgM3YsrixVf1avPcjF8jtXWrEQ0KGPThOSTJWtxtLfI88fs+qF38p632OMXil4FMWZE1c7LM0= Authentication-Results: linux-mips.org; dkim=none (message not signed) header.d=none; linux-mips.org; dmarc=none action=none header.from=cavium.com; Received: from ddl.caveonetworks.com (50.233.148.156) by BL2PR07MB2420.namprd07.prod.outlook.com (10.167.101.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Tue, 14 Mar 2017 21:21:52 +0000 From: David Daney <david.daney@cavium.com> To: linux-mips@linux-mips.org, ralf@linux-mips.org, James Hogan <james.hogan@imgtec.com>, Alexei Starovoitov <ast@kernel.org>, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Steven J. Hill" <steven.hill@cavium.com>, David Daney <david.daney@cavium.com> Subject: [PATCH v2 3/5] MIPS: BPF: Use unsigned access for unsigned SKB fields. Date: Tue, 14 Mar 2017 14:21:42 -0700 Message-Id: <20170314212144.29988-4-david.daney@cavium.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170314212144.29988-1-david.daney@cavium.com> References: <20170314212144.29988-1-david.daney@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: SN1PR0701CA0003.namprd07.prod.outlook.com (10.162.96.13) To BL2PR07MB2420.namprd07.prod.outlook.com (10.167.101.144) X-MS-Office365-Filtering-Correlation-Id: 311be081-d4be-4bb1-018e-08d46b202284 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BL2PR07MB2420; X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2420; 3:LibuxwJ5Ra3ub43GVjhfBSPunsWj1S7wZ9uEOv7Nqe5HEKcqgSAa5klyIiH/BkNENky9UiluhOqN6TptmEJw8HwOFwmY20RW2eVGIFELgMaJCg9kdtMXIMDYFPz2fswpwCmdM5W7HbsVaoepH5t4nt1fw/UGFgRCeKBLuuEed0o2GVdYwQLTyO9yUF78zAQ4QyQHaxLr6xAr5kPotjYj9bIkXjzlfsU50liav2E8Xx/mK8pGuFXYFadQcjMWS2Ii0OtkUcXSLnhBNEXn4nwOKg==; 25:6Z8IgC41wyCm0lfP6tUgAHK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BUi4/22WtAcHMLS1fPRZ5s0s0NfmfWHBYT+VvOKylpkGENDRX8+qVPYtuXDdD9YTCjvHpcbA93byQ2+3UNsoI+FxhfMeXeRlmVzjW58VdWp/6J+beh+iZgFrlywbspe9Xid8FRAEh+d6VUO8C+JtmSdwOoOzZPNyiBZkuVD1FeuQk6tbf1m28MYpRWXno2Y5d/qhFB X-Microsoft-Antispam-PRVS: <BL2PR07MB242021D3F9AB0CD272FE058C97240@BL2PR07MB2420.namprd07.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123558025)(20161123562025)(20161123560025)(20161123555025)(20161123564025)(6072148); SRVR:BL2PR07MB2420; BCL:0; PCL:0; RULEID:; SRVR:BL2PR07MB2420; X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2420; 4:eVVswZ126Kq7n37mR6GyRd2Do7ZCo8l3Oi3lL1WEgJc8QGP3T9mvGcUXzJ+F9WYiCbyzbsJleUpHsO8q/to+S/nMSvxBRo2r6pDhuQSo+S2vZq+GQz1jrb79xAGtWdlbk3VJZCyWtKbf/Zzq45hT7jUfA4M+w/8k+TPG9WeJLLfx3/4f7+o5MsQdaC/HadRWpG0MxvcJrew4kD3p8j0LwK/vIkn3UcxTrm0bNIsyns0Jeuo4qgxDkJd0oN9q/yoBFXGQw1U2r86d1AS9eTHs0LnXOa7ZD6AQLO87OEM2NSUWGaX5zyKftsowbUhdmCTJZipqQNuzrMdJeqjPKikZylU1cz7aL8UT/PfuNG0fb6p5PGBgcxV0owHEop2d+3aiMrK5dUj0PWHoAJX0f2haHYsqx05c0QRZ3xARwKNNVW/MiymoRjo5oKZmv6LJH9hQbl1EuyFNaWoYl8ZIbictv1qxXaJd8ttREq6s82kaPRv5mNDApBCVf9pfAWfiNOEvUwyadDxKQUw9K+yj/yyDbFWGaGvjE8tc0pe0hcFlcZm/1lTfbuyh7XmboSJ6GRTgf5SS0A9aM8GRA5Yiz7uwESqgjlio/cma2bF8KlvecEk= X-Forefront-PRVS: 02462830BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(305945005)(50986999)(4326008)(36756003)(7736002)(6116002)(50226002)(3846002)(8676002)(50466002)(81166006)(5003940100001)(48376002)(54906002)(76176999)(6506006)(42186005)(107886003)(38730400002)(1076002)(86362001)(25786008)(53416004)(6512007)(6486002)(33646002)(47776003)(66066001)(53936002)(2906002)(5660300001)(189998001)(6666003)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR07MB2420; H:ddl.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2420; 23:SlB7h94mwJiKX2Y5zJ8RmXrmyZAqrHN2C6/7xzTQkXv7svJhAdHoiBFrc0suLv4BdinK8TtjzA2mbScYeJ5HFwbUAoEjWbZrPTkWQPjFV18N/mzGMjo554gj6nx4DIpUuggeZal6MFmPMfSdLUiuZZuNfWRN9bAnTNTp0qUhYTNKcE6odSU8RC2IvCeWuhVKEAtZze5O2j+qdtwqyrAT99ty8Lezt+eHRAbOl4q8u6rEl2cesbdk7uFStCQgL57IyZcEXL8oOdZ7YJ8BB0q3uauPcAju7wkKCA+TF1C1byT2Dj5va/4LDCE8uau5+WKv7rlB8hDmEyIUTTojbEQLB2KZ/JaXSk5qcBVT4jrujBECfYNl+O8NpOo3jtCDJg5oSZMfXMHTiXGMSzX6BIqhgtaNtBQYXZK4CugyJzCuF7KtfsSHuA6TY3oW691Ot4oTdRVLn0GfkgoPhcWNj+a81WHhgBY3+T2y2bW6ZepF6TtnzXvTfO8vyxwVOMcKhoBNiKWPT4V2gN3tPRHBM7wXXitBwCfVyApdir8osD9wQzgSMLMsj0eIQ7MsEz2jXYa/UU55f/AZF9Q/FXHHMH1qlbtu91gA+ZFkqKJF/ngxXm1tK5hHw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NSPM X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2420; 7:xjr2u1FHG+AFXZVtW+RhDHPIlspBdvHwFGJSE/9SCNM8XxZ4QER0u80w2wRPM4nkybBfezGXxHjEyRpKFY05q/JRAWGE2Bb8UTIXeSjffRVUxPGsadX88NtsseTv/+ItWVvEapmA3HQVigJ/WF+BfwigUPeWgEbbBQk46inm/BNoOiBrQU5CYu/v07qZMFZ7MZYfBqA3jjJPD6D7ggfUUhylPOPww7Na+aShrb+gxXgB4XXcun4NN8Qjex0yVR06AuGecqldwD/UxoIGSJ2yuLiaMoNTQEOPKgXqhT+xfheBdl5A0cCDs4z9LTxdZmbhUCG0JZuDNUkU4OtFLISS9g== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2017 21:21:52.1096 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR07MB2420 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: <netdev.vger.kernel.org> X-Mailing-List: netdev@vger.kernel.org |
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index 880e329..a68cd36 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c @@ -1156,7 +1156,7 @@ static int build_body(struct jit_ctx *ctx) BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); off = offsetof(struct sk_buff, vlan_tci); - emit_half_load(r_s0, r_skb, off, ctx); + emit_half_load_unsigned(r_s0, r_skb, off, ctx); if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx); } else { @@ -1183,7 +1183,7 @@ static int build_body(struct jit_ctx *ctx) BUILD_BUG_ON(offsetof(struct sk_buff, queue_mapping) > 0xff); off = offsetof(struct sk_buff, queue_mapping); - emit_half_load(r_A, r_skb, off, ctx); + emit_half_load_unsigned(r_A, r_skb, off, ctx); break; default: pr_debug("%s: Unhandled opcode: 0x%02x\n", __FILE__,
The SKB vlan_tci and queue_mapping fields are unsigned, don't sign extend these in the BPF JIT. In the vlan_tci case, the value gets masked so the change is not needed for correctness, but do it anyway for agreement with the types defined in struct sk_buff. Signed-off-by: David Daney <david.daney@cavium.com> --- arch/mips/net/bpf_jit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)