From patchwork Thu Feb 16 12:29:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Fleytman X-Patchwork-Id: 9577015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2A78C600C5 for ; Thu, 16 Feb 2017 12:30:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1017328516 for ; Thu, 16 Feb 2017 12:30:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0438D28583; Thu, 16 Feb 2017 12:30:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D6ED28516 for ; Thu, 16 Feb 2017 12:30:50 +0000 (UTC) Received: from localhost ([::1]:46120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceLCz-0003M4-H5 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Feb 2017 07:30:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceLCT-0003HN-9t for qemu-devel@nongnu.org; Thu, 16 Feb 2017 07:30:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceLCS-0007zO-Dt for qemu-devel@nongnu.org; Thu, 16 Feb 2017 07:30:17 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36835) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ceLCS-0007z2-83 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 07:30:16 -0500 Received: by mail-wm0-x244.google.com with SMTP id r18so2881866wmd.3 for ; Thu, 16 Feb 2017 04:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tCZlilqh0GHaCg1XzpaecgYCYXUx95QpqUZMrujLl9A=; b=O+dp+RzTsViPh7w2u482gewmHGDb3J/drFXaavCeeYxQF1AA1oZh0OFqQEbwrlittd 3pBiDF5Jj9JoCa8n4C7yZ3NNNJOxCVVf4lkCxI32vXuPnr6FrGy3qr9hRjN/DSObiJCN 6HWx5TrBQuAdAsZfrBUx6CfjUnHRntRB6zJre9HZH0dMGBuP5N8KvL+QszxPz9aO99B0 pzc64UBGkU+3YbZFAjioL8uNO9bFnzMLlmSAU0r5JMWFCTdv80XtFqyfn8tGSPXVu179 v9MzubIHfjFZgsbDcqPabnMnYu80BkEXuh7cZqnYwaxkP3soJ+aEmZv6udahidvIj6iG mhqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tCZlilqh0GHaCg1XzpaecgYCYXUx95QpqUZMrujLl9A=; b=YW710u3+gFN4noWyBWgE/T0AG/EwjpywSXzi9p6VrByc6aRf7px8DkofnFd553eGcZ ZMpiv99kyELKOOHgAFEuXMtTciv7SSXw6ezD36FlbLuYLj7MSbrPxQKaoSLYPNrWKSCY IGwCir8sfmWpsVbIgKc20vIDQ1QxBZ7W0p3FcL5dHyFcYWRSS+P1TWLiavyc0BlWE3ms 2bQbQYp6J1HeUjuDX3j04qZtcLxV7bwSmgk8lZXGoyw1FeJM47SFApHyy3S/pGfSYJWi Bi3Zx4P3QnQAuvccgdyL/tkh4gH0K230XQ8z54Kit22LZYKC8qgOpTHlKLWGupZLQI4N KZzg== X-Gm-Message-State: AMke39leKjFX9EiX1KoIK+ZKPvkKUkzW76vyIVpUvREtFsbeoAZsmih8iYk4mxp+16NMMQ== X-Received: by 10.28.209.7 with SMTP id i7mr11808318wmg.115.1487248215215; Thu, 16 Feb 2017 04:30:15 -0800 (PST) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id b51sm8827365wrd.39.2017.02.16.04.30.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 04:30:14 -0800 (PST) From: Dmitry Fleytman To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 14:29:34 +0200 Message-Id: <1487248176-29602-4-git-send-email-dmitry@daynix.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487248176-29602-1-git-send-email-dmitry@daynix.com> References: <1487248176-29602-1-git-send-email-dmitry@daynix.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH 3/5] NetRxPkt: Do not try to pull more data than present X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer , Dmitry Fleytman , Jason Wang , P J P Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In case of VLAN stripping, ETH header put into a separate buffer, therefore amont of data copied from original IOV should be smaller. Signed-off-by: Dmitry Fleytman Reviewed-by: Philippe Mathieu-Daudé --- hw/net/net_rx_pkt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index 7c0beac..d38babe 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -96,7 +96,8 @@ net_rx_pkt_pull_data(struct NetRxPkt *pkt, pkt->tot_len = iov_size(iov, iovcnt) - ploff + pkt->ehdr_buf_len; pkt->vec_len = iov_copy(pkt->vec + 1, pkt->vec_len_total - 1, - iov, iovcnt, ploff, pkt->tot_len); + iov, iovcnt, ploff, + pkt->tot_len - pkt->ehdr_buf_len); } else { net_rx_pkt_iovec_realloc(pkt, iovcnt);