From patchwork Sun Mar 14 11:11:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 12137261 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99B74C433E6 for ; Sun, 14 Mar 2021 11:12:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6897764EE2 for ; Sun, 14 Mar 2021 11:12:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235103AbhCNLL3 (ORCPT ); Sun, 14 Mar 2021 07:11:29 -0400 Received: from mail-40131.protonmail.ch ([185.70.40.131]:20443 "EHLO mail-40131.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235222AbhCNLLU (ORCPT ); Sun, 14 Mar 2021 07:11:20 -0400 Date: Sun, 14 Mar 2021 11:11:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1615720277; bh=KbKHs69Z30MoR2CtDmYVM6+lpepKa3puU+bMA1kdp8c=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=ZdCyRk1nOKrJG9lLfRFY2DXyTZAKrUppPS7VAtbmlZW5RfaBw4OV8z3FHGoTxIyT7 srv3DCI7hjaJILMJ9XOXoGAaAqhHLd4QM6UBj348vDscQ1JP78agr3WvekdPUkWfF/ iUbfuBD11PlYbQ3dFACoHmxr1XxTKW6X9BGFSsVnh9+D21LFybgWgMT8qemg+1NvbQ ksArYh3bbbYGsH7eN6PBPH8PKPSam6RrT/FOwo8eL/N/2SOrjxsOxmhqq6lDouCovP aa4pXInD4BGp2UxLpkTQFvTSJHw1zgJBLJ6QyVzYOtkQ9CqIgjlMw0WpNMSrLG25Xp F0LxaSBgOA4hQ== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Jonathan Lemon , Alexander Lobakin , Eric Dumazet , Willem de Bruijn , Kevin Hao , Pablo Neira Ayuso , Jakub Sitnicki , Marco Elver , Dexuan Cui , Vladimir Oltean , Ariel Levkovich , Wang Qing , Davide Caratti , Guillaume Nault , Eran Ben Elisha , Mauro Carvalho Chehab , Kirill Tkhai , Bartosz Golaszewski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v3 net-next 2/6] skbuff: make __skb_header_pointer()'s data argument const Message-ID: <20210314111027.7657-3-alobakin@pm.me> In-Reply-To: <20210314111027.7657-1-alobakin@pm.me> References: <20210314111027.7657-1-alobakin@pm.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The function never modifies the input buffer, so 'data' argument can be marked as const. This implies one harmless cast-away. Signed-off-by: Alexander Lobakin --- include/linux/skbuff.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 483e89348f78..d6ea3dc3eddb 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3678,11 +3678,11 @@ __wsum skb_checksum(const struct sk_buff *skb, int offset, int len, __wsum csum); static inline void * __must_check -__skb_header_pointer(const struct sk_buff *skb, int offset, - int len, void *data, int hlen, void *buffer) +__skb_header_pointer(const struct sk_buff *skb, int offset, int len, + const void *data, int hlen, void *buffer) { if (hlen - offset >= len) - return data + offset; + return (void *)data + offset; if (!skb || skb_copy_bits(skb, offset, buffer, len) < 0)