From patchwork Wed Apr 22 17:45:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 463789 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 376141402DF for ; Thu, 23 Apr 2015 05:50:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=yUAB6jCr; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8BDC7A14D8; Wed, 22 Apr 2015 19:50:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GAacd0Wf-uVT; Wed, 22 Apr 2015 19:50:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 76DAFA14C3; Wed, 22 Apr 2015 19:50:52 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id E47F91C2851 for ; Wed, 22 Apr 2015 17:46:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id DFB2F95D63 for ; Wed, 22 Apr 2015 17:46:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rh6G_fK6KX0A for ; Wed, 22 Apr 2015 17:46:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 519949A66F for ; Wed, 22 Apr 2015 17:46:12 +0000 (UTC) Received: by pdbqd1 with SMTP id qd1so280641933pdb.2 for ; Wed, 22 Apr 2015 10:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gIFMNQasyqo1Z5quIcFP2Xr0PS41oveJmTxIdzvI/1A=; b=yUAB6jCr7DM5ld3f1sSagdNShKz7wS5un72B6zADBqdnN9IUmdzpYp4ElZHArQNoOE tkZSl4tCBmUJcWlpUiLK8ESZu0nBlJ2xLvpCQ7uIz4G51dyttIdluksSpobsV2pUoxjf V4r4nYQgfLnwrgCBDle3nTSH7v/EZkHKDHehmINGXsPedPyHQw2e7Dh+l5iU5xYUTsg/ JSX8ztWyeYpkB1ncgoHoCRtI/nhTr+WBqm31uu3fY1y0Wk2nCgiZPQOsrtjUJNNKpaCo pPEvGLeQ20y11B8EqFC8B9V+9czb8kD/w+3pieifFRWmaY6E0GhgS6zQinXUl4jNRKLP 6JPA== X-Received: by 10.68.215.97 with SMTP id oh1mr2033062pbc.88.1429724772122; Wed, 22 Apr 2015 10:46:12 -0700 (PDT) Received: from localhost.net ([8.25.197.27]) by mx.google.com with ESMTPSA id id2sm5634121pbb.56.2015.04.22.10.46.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Apr 2015 10:46:11 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Date: Wed, 22 Apr 2015 10:45:58 -0700 Message-Id: <1429724760-10075-2-git-send-email-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1429724760-10075-1-git-send-email-xiyou.wangcong@gmail.com> References: <1429724760-10075-1-git-send-email-xiyou.wangcong@gmail.com> X-Mailman-Approved-At: Wed, 22 Apr 2015 19:50:50 +0000 Cc: Cong Wang , intel-wired-lan@lists.osuosl.org Subject: [Intel-wired-lan] [Patch net] fm10k: pass the correct maxlen for eth_get_headlen() X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" The second parameter of eth_get_headlen() is the length of the frame buffer, not the header length of skb. Cc: Jeff Kirsher Signed-off-by: Cong Wang --- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c index 1b0661e..cd044b1 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c @@ -543,7 +543,9 @@ static void fm10k_pull_tail(struct sk_buff *skb) /* we need the header to contain the greater of either ETH_HLEN or * 60 bytes if the skb->len is less than 60 for skb_pad. */ - pull_len = eth_get_headlen(va, FM10K_RX_HDR_LEN); + pull_len = eth_get_headlen(va, skb_frag_size(frag)); + if (unlikely(pull_len > FM10K_RX_HDR_LEN)) + pull_len = FM10K_RX_HDR_LEN; /* align pull length to size of long to optimize memcpy performance */ skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));