Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2385250pxb; Thu, 11 Feb 2021 10:58:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrq2HbqYkLluYRZeWR1sEyDOwZMNOa/hJmU29CV7fJKpC12uqmCFST1sEOGpHS81J2lZuL X-Received: by 2002:a17:906:1956:: with SMTP id b22mr10258559eje.114.1613069908378; Thu, 11 Feb 2021 10:58:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613069908; cv=none; d=google.com; s=arc-20160816; b=k8yJPuOivZkwo0S6x1A8+7yH+uQizyhavc45tRgL9JHQoafYAOSPMS7bhWiq/bY5zA oN12bmGeNoKd0UXSsPbmReiCca4wqDekEsthqv8HtGJR7fe1Qe1LoUWWXqUACqutMnMu +RhEnUDWKCrell3oKgGSyRcnabw2LnsHxnDransqx+JE21Yo31bQAasIugzCYBPbWMVd 91m6EB9T9qDeh5ugPMLEAngeJZ/gQcwtEBg12f23r1nDpBeJRHtDe95UCKfuxM2Rh1Hf 9VRJDRy9BihehCySzdqUsEVqLWpeeEtjUka5tsvuvzxfWdeEMcja2yB2kR2VPGXpB3r0 u9iw== 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 :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=yJJMTncfQhh58ye6yAPpr/XHKg/skCQ3mD0O/lX7vIM=; b=DdL3SwZY3HS54sjwAUT+1xmJGkLu440h5WvGzEt2auzS9cYuKcKPv56vLZBpwcqEpu h5g7LWX2PvltDJbWFmUcSeUNJbK2eil1wA5fNLmipPOvBFJT8D1fWmjJj9btlr87MoAT EuiD77t38a2k99YpgaHuKk7Dq7LoMSvzFdH9sZCaGwkJ6Hadq9sgqJO7ekabuxPwGtz4 toFNTsqD1frfwdF8WZXMyGd/x/u8sIpSlgCoRl6YNq0BfNfTpqw9fwa48EJCTLg63OKJ tOXglbVlXRfFvVeQnpi4YhHVatKWtQaQspwfWnH/cyeMJLzHLQ/fTA6ap2/zK65B4Ee+ lglw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b="RL0w/hod"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fi28si4303408ejb.379.2021.02.11.10.57.42; Thu, 11 Feb 2021 10:58:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@pm.me header.s=protonmail header.b="RL0w/hod"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231197AbhBKSzm (ORCPT + 99 others); Thu, 11 Feb 2021 13:55:42 -0500 Received: from mail-40136.protonmail.ch ([185.70.40.136]:26902 "EHLO mail-40136.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbhBKSyU (ORCPT ); Thu, 11 Feb 2021 13:54:20 -0500 Date: Thu, 11 Feb 2021 18:53:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1613069613; bh=yJJMTncfQhh58ye6yAPpr/XHKg/skCQ3mD0O/lX7vIM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=RL0w/hod3XyE63H6gn9VU1ijlK7SMvba6yX79+nhb3qdmgweYAQQSmUZ/STLj+nFo oiWp0iWJ3U7nzZZxQOPjP3bCb/bAtI6Y8KYrabAssbYwQ0IWmyVLmg5Ajln4lgmIS8 Ab5iDr/iuwaVbepvqzjheT/53MJcsxuCVNgGHPn6lWEFJAKKHaSqUTRY2cs29Mz23D YL7Ce5G/x6onPjBLMCGheKUGwrEm/dbjq9aaoygnVwAWhIXrHJIMJ+TxRkaD5jz/Sc dqqR9ueRW+QKSmfc5ztPoDYCZdX2zmpNb9U/U3A1PStT2a7n5lyCSoAM3ZERtvj2zU Pqk2YmMHBJYRw== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Jonathan Lemon , Eric Dumazet , Dmitry Vyukov , Willem de Bruijn , Alexander Lobakin , Randy Dunlap , Kevin Hao , Pablo Neira Ayuso , Jakub Sitnicki , Marco Elver , Dexuan Cui , Paolo Abeni , Jesper Dangaard Brouer , Alexander Duyck , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Taehee Yoo , Cong Wang , =?utf-8?Q?Bj=C3=B6rn_T=C3=B6pel?= , Miaohe Lin , Guillaume Nault , Yonghong Song , zhudi , Michal Kubecek , Marcelo Ricardo Leitner , Dmitry Safonov <0x7f454c46@gmail.com>, Yang Yingliang , Florian Westphal , Edward Cree , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v5 net-next 03/11] skbuff: make __build_skb_around() return void Message-ID: <20210211185220.9753-4-alobakin@pm.me> In-Reply-To: <20210211185220.9753-1-alobakin@pm.me> References: <20210211185220.9753-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __build_skb_around() can never fail and always returns passed skb. Make it return void to simplify and optimize the code. Signed-off-by: Alexander Lobakin --- net/core/skbuff.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 70289f22a6f4..c7d184e11547 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -120,8 +120,8 @@ static void skb_under_panic(struct sk_buff *skb, unsign= ed int sz, void *addr) } =20 /* Caller must provide SKB that is memset cleared */ -static struct sk_buff *__build_skb_around(struct sk_buff *skb, -=09=09=09=09=09 void *data, unsigned int frag_size) +static void __build_skb_around(struct sk_buff *skb, void *data, +=09=09=09 unsigned int frag_size) { =09struct skb_shared_info *shinfo; =09unsigned int size =3D frag_size ? : ksize(data); @@ -144,8 +144,6 @@ static struct sk_buff *__build_skb_around(struct sk_buf= f *skb, =09atomic_set(&shinfo->dataref, 1); =20 =09skb_set_kcov_handle(skb, kcov_common_handle()); - -=09return skb; } =20 /** @@ -176,8 +174,9 @@ struct sk_buff *__build_skb(void *data, unsigned int fr= ag_size) =09=09return NULL; =20 =09memset(skb, 0, offsetof(struct sk_buff, tail)); +=09__build_skb_around(skb, data, frag_size); =20 -=09return __build_skb_around(skb, data, frag_size); +=09return skb; } =20 /* build_skb() is wrapper over __build_skb(), that specifically @@ -210,9 +209,9 @@ struct sk_buff *build_skb_around(struct sk_buff *skb, =09if (unlikely(!skb)) =09=09return NULL; =20 -=09skb =3D __build_skb_around(skb, data, frag_size); +=09__build_skb_around(skb, data, frag_size); =20 -=09if (skb && frag_size) { +=09if (frag_size) { =09=09skb->head_frag =3D 1; =09=09if (page_is_pfmemalloc(virt_to_head_page(data))) =09=09=09skb->pfmemalloc =3D 1; --=20 2.30.1