Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3694613pxb; Sat, 13 Feb 2021 06:15:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwL/pdqzLuh18wEP4PBGIDiAKaMfTpBsMuKixka/Nevrpyhq0+3dT/PqKlPy0OAbx9TZksh X-Received: by 2002:a17:907:c27:: with SMTP id ga39mr7858112ejc.68.1613225744163; Sat, 13 Feb 2021 06:15:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613225744; cv=none; d=google.com; s=arc-20160816; b=iOLNP31O+aHAbLvYtDczT6OdvY9XzVaLXz6/6Znr1RmDRW8Xhtn0qIhI/FafLh/A6b nI6XD43DvbN9blW4h3uBz8zzSXVLE9+RL8lv6pryzaTSb9/IhGi2tGwtRdgpkiaZUBZO wUPiXvH1ePyaGJZdxJKRAb+BYzikJihJx0KiDaWMEQKMilzHbZXW8PDDI15+otIkmxC9 nF/5EswtYqsPcc/evCdRfcfFzVsdoI1ooeajviXhwBuUzcfAjMFVjaJVebWTsBMcua5e 7WJlPM2vLGKrqlF16ATCLRWhdxCQ9zJpw99H+PTyVfrPQmLthZkDkCuGEa9e6w5i8Qfc gQGQ== 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=Ua4RiUpQKwTYE4Ia3UDa5kU4/SZ+0IM3YCutTH2MQLcLRb4wOG+KdOAMSz/89SlO9S XDpb89taJxgND30I0RvJncF63KJUw4wMMlt43Sb1ovuIIWipdopzvnWRuWFJ8Lc2viZP y7dwDN9NUTiwDZVIK3S2CcWUXX9plZ8WoNGE52znEYZDwrL5vQvJdxpXh/OUjwRh8Cib fuG2F6MEpc1Yy0H2Ifkpm8mZl1cxaw3imMUXEVX403yu1YCul/hp5sk4GZfKg3wfRYGN w8Gi7ut1sUDc9sv1b8Vi/lopcnwID5KymeBaEF3H1/cdeyFzUk8b3piNVFIn8fzStP+h SZpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b="f7pCt9F/"; 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 e2si3226957edl.307.2021.02.13.06.15.21; Sat, 13 Feb 2021 06:15:44 -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="f7pCt9F/"; 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 S229798AbhBMOMk (ORCPT + 99 others); Sat, 13 Feb 2021 09:12:40 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:15274 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbhBMOMQ (ORCPT ); Sat, 13 Feb 2021 09:12:16 -0500 Date: Sat, 13 Feb 2021 14:11:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1613225493; bh=yJJMTncfQhh58ye6yAPpr/XHKg/skCQ3mD0O/lX7vIM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=f7pCt9F/r10dH/B9CS6oBKKG+J93b3K49TyJgz6eJtyDD5rCaM46UWklLBb80cK6O VkbG6TbiwR+CseveAHBACPwRdbHuJRI68hqLGkQK0FJZiIEfeRasiLVOeys7Y1m8Mo qC93OKFGxGCbsOofbHOQZERDyz47LeTvb+/8VVVI8+slMPUXxI5ZxtFHfwnrLIh3nx aZpONkZOf3wUehNebCM7neceVGvxofHQriMlWmQhNeYYnZ4Ancgz8uKDk0mvYZm/Ma g1dGkWy5ah+6Fm3S7jp5NNkjcelL2BxcvHiyhnwR7KQ3o/zNZ8OHT7ivgPWMn9436z /TK99OPDwkycA== 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 , Alexander Duyck , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Taehee Yoo , Wei Wang , Cong Wang , =?utf-8?Q?Bj=C3=B6rn_T=C3=B6pel?= , Miaohe Lin , Guillaume Nault , Florian Westphal , Edward Cree , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v6 net-next 03/11] skbuff: make __build_skb_around() return void Message-ID: <20210213141021.87840-4-alobakin@pm.me> In-Reply-To: <20210213141021.87840-1-alobakin@pm.me> References: <20210213141021.87840-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