Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1448998pxb; Wed, 10 Feb 2021 08:33:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6D3kt7dnNZc0kIgzYdqYd/acGz5m7pzPz2AznHV59L1MEAUg1LR5uElrR95gIT/tvyvpp X-Received: by 2002:a17:906:ecfb:: with SMTP id qt27mr3702447ejb.123.1612974839376; Wed, 10 Feb 2021 08:33:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612974839; cv=none; d=google.com; s=arc-20160816; b=Q2Cym5AWfM2GFyRGQ/ttduxOPlPYlxnFyBzuBZAyAYaF2f0L8FvX/qlxkGFBdfCthF WqSkr1V4onpgxyoX+SDAgyzVu3IS4IUW0C+v/Xego90YK5G6jg3lNw+UXkXERy5quOYD WmeCYdo4wHfF4zq4pAYDSjdqedvrrEzg3asQjDpRfBINyOFLtSeT11DRj+NJynn1s0vc rFZ+jn2hZiIm/1ltCYZBXHqDbn1F23o7j/s07CYnDWxt/AVdKdMOQ6fHmJ88SYbgq8xB hCLDz3RszP1A/lRdLo7pUsPQBEJoDgtt6tHQx2qgIrpL9ZFBGU8vwn63A1tf78p5Wljd ogqg== 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=UX2s8tkbTbSJnroLV9Z94DRw8J5u5tdCNpExqxRWMIyoDASfUQqC8v9NASmo7kCal+ R21281Wj7VXIFCPuvziJUi+vdBeq9Oc+nAycMRWhUXNbESz8ht1f1fpHt16akZVWJIZi jIPo/ak7gUcGFNDqoXKhIo1xlsQzdUcmzvcpj3ANshy9FVwa0Adgxu8w00GDULNVLvc9 wK1j6A90mpu4pGL+ylzo+NgZQy/4cicnkf/Ve2vju39jFRRkRNXqLLmVsRyLJFxRV3pv YOeVa0A5onLYu52wC2V8mhVcTsQL/cD2ds/7Xr8Z//BoU87VXqu7Th950YM39JUsYXUv kX2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=MIIGrlbo; 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 s15si1700220edj.492.2021.02.10.08.33.34; Wed, 10 Feb 2021 08:33:59 -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=MIIGrlbo; 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 S232592AbhBJQbe (ORCPT + 99 others); Wed, 10 Feb 2021 11:31:34 -0500 Received: from mail1.protonmail.ch ([185.70.40.18]:61294 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232476AbhBJQaC (ORCPT ); Wed, 10 Feb 2021 11:30:02 -0500 Date: Wed, 10 Feb 2021 16:29:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1612974548; bh=yJJMTncfQhh58ye6yAPpr/XHKg/skCQ3mD0O/lX7vIM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=MIIGrlbocUP9/X5eBiQ6YcfpGp9ltvi+Th4d3DSHmsQarWwtzfHN49zBjeQHI4QOJ i/BW63QCJt8wAJ+BtnGiPY2Xov9j2D4fsjROnr/PAiWr11aJRj17b2K3bmLM6sorrT +AM1YN/fhcIITzOeqs20CTnXMoZD3r/TOxnOHW9SCMjtclxsXBSXJKLjLyVGTfqVyz cvJ4mGJOAsnnBe21knbrY+T+Pei9omB0QioRn3ACPFMsn0L+Wbjb3RxDG7gD9AlwmT Eaey5EWGdRXV3n/3iH1zzvFCyh2CzvHbV2xd/8NH0cJS1KQ3Sv5JFS5aTlGcAapfMr dwDf4bEh8gyKQ== 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 , 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 v4 net-next 03/11] skbuff: make __build_skb_around() return void Message-ID: <20210210162732.80467-4-alobakin@pm.me> In-Reply-To: <20210210162732.80467-1-alobakin@pm.me> References: <20210210162732.80467-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