From patchwork Fri Mar 12 19:46:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 12135907 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 BB8D2C433DB for ; Fri, 12 Mar 2021 19:47:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8849964F80 for ; Fri, 12 Mar 2021 19:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234328AbhCLTrK (ORCPT ); Fri, 12 Mar 2021 14:47:10 -0500 Received: from mail-40133.protonmail.ch ([185.70.40.133]:21121 "EHLO mail-40133.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234472AbhCLTqk (ORCPT ); Fri, 12 Mar 2021 14:46:40 -0500 Date: Fri, 12 Mar 2021 19:46:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1615578398; bh=rmYbHL79wt4dhIbnCttbVVGP2ZT2H/KbCOCNp0UQlaM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=NnATg0XMUItsW7CInI6e5paZ1QFL20P+ng7ZZFL/MNPwjsHBBW0hETFmUNezUKdjX 8KTwO3fS7w4pZpOGUXDTDi3G14R82yf0bXc0LNzsWViev3hjghwRW3ZMbLwRAhL540 78x8OJfu5bdmPFajVTxmQUXLC1yKnkNuIV7wotsfXfweJ4+JZH04YFE6IaaJFv52l+ mD0qm3liXPGkK3YDyS2FwEy8VQBfd3UVGJqMJbxedGb50nKLPhS8RIQgE3b+qxLJtO 2tMVA5oR713TE9sqZlVN/PQ0tY9+14Us5HnvPA9t4K2qU6NvUqimH5sd5sjVI0LMq+ Hs33ItmmEt5Eg== 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 net-next 2/6] skbuff: make __skb_header_pointer()'s data argument const Message-ID: <20210312194538.337504-3-alobakin@pm.me> In-Reply-To: <20210312194538.337504-1-alobakin@pm.me> References: <20210312194538.337504-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 0503c917d773..d93ab74063e5 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)