Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp374857pxa; Thu, 27 Aug 2020 05:01:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuGOl1guCZYRX+9KJ8edS7PvbhbVJCcgEWSkpTZhtHVxxkI02xETm5noe8BjcbVQHdN7xO X-Received: by 2002:a17:906:5914:: with SMTP id h20mr16426124ejq.346.1598529663256; Thu, 27 Aug 2020 05:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598529663; cv=none; d=google.com; s=arc-20160816; b=PObj3HYjlMm6Cj9RZBiBow0TEWM4H3f34Y6eVhcgDPQ85E2jH6nRpwGLKEb7uAeGfP nOqhDTm2SwMso0PReBkTrc5WngBYa99y7uNePo55amWjbEMUMtFE31YUGUn1t9DRos/H 37M+wktilFRsSjnWzy3S5W796n/94e1HsQsC7z3cC30IyU2Gfq4sAGRP4YkqHqPDavPe iz6BRWmzGTTNLXVcRPaVIjolI2AVvP3FZXw891zndk2w0HyUcrPkJFyGofC4ja/wk6pm tJuQh6k2xkg+ws6hlPhWu556FXUeo3pSV3+pBV/3mlChhZpkfPfZIMJDM7SzIzBI2/+J OsUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=AqsCikGozeykmwb1siB2sdHsnAq0jBLxSrWyy0RRzbc=; b=BZ1AYp43s/wg92Vy/xR0lF3Ap6WDQSP1Jfed17BhCPTF9qDnvrgSslyAqDyTirNIxv 3NFKYaVPH/hRT7f9qyUU9IfzQpRir5WZWeEAQ9gV2Rxq9U53iFs/yGSgQpJxYpcntxWN Ud1DqcQIeNOlxwpGj7LdC/5kezkKqrCL3McdcwzeaIhIVB1h8rr2EMkyBFdAegPnqv2Z OQq351FTubLL4DtyIWw9PJw3PV7J5jAM9DeFfwvBeheuy8/dITjaq9KGoBcxR4yUMSU1 ETgjngnBMxZGi+zQUt44VwbTPHAuPIoZo0e1q2mOT5AsZTy8hVm7RX2bjvu31JXjxV3R IeKQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si1107528eja.645.2020.08.27.05.00.39; Thu, 27 Aug 2020 05:01:03 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728896AbgH0L6l (ORCPT + 99 others); Thu, 27 Aug 2020 07:58:41 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:10331 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728834AbgH0Lmz (ORCPT ); Thu, 27 Aug 2020 07:42:55 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B3045BEE75981B411CD0; Thu, 27 Aug 2020 19:25:01 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Thu, 27 Aug 2020 19:24:51 +0800 From: Miaohe Lin To: , , , , , , , , , , CC: , , Subject: [PATCH] net: exit immediately when off = 0 in skb_headers_offset_update() Date: Thu, 27 Aug 2020 07:23:42 -0400 Message-ID: <20200827112342.44526-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the case of off = 0, skb_headers_offset_update() do nothing indeed. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 18ed56316e56..f67f0da20a5b 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -1459,6 +1459,8 @@ EXPORT_SYMBOL(skb_clone); void skb_headers_offset_update(struct sk_buff *skb, int off) { + if (unlikely(off == 0)) + return; /* Only adjust this if it actually is csum_start rather than csum */ if (skb->ip_summed == CHECKSUM_PARTIAL) skb->csum_start += off; -- 2.19.1