Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp910132pxb; Tue, 9 Feb 2021 16:22:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAlbiz7+C1gzxhFcryAjOTpE0Dy5WlGM52dNvd5IBul4TVxO8+ZM4NzRnwe/sreAmdA4r9 X-Received: by 2002:a17:906:4b42:: with SMTP id j2mr287002ejv.544.1612916558863; Tue, 09 Feb 2021 16:22:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612916558; cv=none; d=google.com; s=arc-20160816; b=RlC0m/Uf6mnCUNNWczl3Ufcsv8XHndnQAEeoWWdYUro2y1fEH4/f5iRlPnOTl1vXj0 HLbmLOqqz7zxyi1paHBNmTXOOiphtFErRwzqrLF5NzFKURkkrrpjzcY0oJt3RjoYDACV PgYZIMizpEDBhJ14MJ5UURomlyOeMo5dz7D5uhbivf7OKJ4u+Yy2LuVursUZ5x8ODmnz DxSEDT7s0sf2XkCxSfje5VikqYwgSkVHsjcuAk+qVYyDbJMFOY0XPKFN/0HbLpRJWHO7 OWCc7D5u3sivylKeWKXB5//XvWNqlKyRIysYI6Fz5Nv6m66TtxdExnqR5c6if5eUUGzR Aeiw== 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=TNjH2OfntVMafeUExGLXFCMb3pBMh6ePd4fTgzTIZmc=; b=KlG69IG29QC1eGPn2xbQ0kCzUkdE7Kf6BTqju5WBghynqiAr5517R1NE+0o8HvjnDu 6JgaGWcuMUV2PgxNUjVvgnfjakYEjaQ3EHzJA+DPuQ/BTmy8TMD4p3U18/92QG+HHBn5 bPAv+OZ3EiRKlm+Ext44ZQVWgpSzBOlnXUxYPUwWcEj6vaizdKJR5absmGL8Jxjvbqe/ oLsnbfBfkN4HEHU6pBQiIyxEiDimg5msWA0iFYnsu+BQgGVeXd0Sg0UZNfLf+rn/Kxpe 9FgOQB9G4loOcOryPb+qnlxcNbI0A0HbCx0zoPXA1OpCb7BRG0eVRGpPCKP6tOZvX5f6 EiSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=ou0BO8bt; 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 a24si228407edm.608.2021.02.09.16.22.15; Tue, 09 Feb 2021 16:22:38 -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=ou0BO8bt; 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 S233644AbhBJASj (ORCPT + 99 others); Tue, 9 Feb 2021 19:18:39 -0500 Received: from mail1.protonmail.ch ([185.70.40.18]:52696 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234074AbhBIUu7 (ORCPT ); Tue, 9 Feb 2021 15:50:59 -0500 Date: Tue, 09 Feb 2021 20:47:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1612903676; bh=TNjH2OfntVMafeUExGLXFCMb3pBMh6ePd4fTgzTIZmc=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=ou0BO8btB9uj5a0JyAgEuRgYLVipOvJTcyXQOi23D/fvjJyTvSB7srawpn7P7pJlv vfZCVrUUnb62n9yoVR8JzDg6AR3qMF5uQD79ypOdZ88KiJNCuJAPk1GnHBbZ9pNbhB NxyU85YPrVN+ggVUuCTPKWC0ye97KNiCiuE+KxFDBAbJjxqvOrPSUeBNNgdLEJE3/M Hfkyya8tWEIAcXtQcH1eBSjxGcU08QVWI1/NHe0E5qcggi/f10kqZfT/Hh6y8PXFQf /j/f1V5D6RtEEKUHSY+oQ3wwc/0B6SLP0Bopk7d1C3qGQ1Gi0RysAnh2Bn7C08xdFf FucsqV32sg3Iw== 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 , 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 , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Reply-To: Alexander Lobakin Subject: [v3 net-next 03/10] skbuff: make __build_skb_around() return void Message-ID: <20210209204533.327360-4-alobakin@pm.me> In-Reply-To: <20210209204533.327360-1-alobakin@pm.me> References: <20210209204533.327360-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.0