From patchwork Mon Jun 22 05:35:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jones X-Patchwork-Id: 28976 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id C9549B7164 for ; Mon, 22 Jun 2009 15:35:48 +1000 (EST) Received: by ozlabs.org (Postfix) id BD690DDDA1; Mon, 22 Jun 2009 15:35:48 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 4F824DDDA0 for ; Mon, 22 Jun 2009 15:35:48 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751511AbZFVFfc (ORCPT ); Mon, 22 Jun 2009 01:35:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751412AbZFVFfb (ORCPT ); Mon, 22 Jun 2009 01:35:31 -0400 Received: from mx2.redhat.com ([66.187.237.31]:58444 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751327AbZFVFfb (ORCPT ); Mon, 22 Jun 2009 01:35:31 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5M5ZXpU004577; Mon, 22 Jun 2009 01:35:33 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5M5ZWoO030937; Mon, 22 Jun 2009 01:35:32 -0400 Received: from gelk.kernelslacker.org (vpn-10-2.bos.redhat.com [10.16.10.2]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5M5ZVw3016913; Mon, 22 Jun 2009 01:35:32 -0400 Received: from gelk.kernelslacker.org (gelk.kernelslacker.org [127.0.0.1]) by gelk.kernelslacker.org (8.14.3/8.14.3) with ESMTP id n5M5ZVYl028389; Mon, 22 Jun 2009 01:35:31 -0400 Received: (from davej@localhost) by gelk.kernelslacker.org (8.14.3/8.14.3/Submit) id n5M5ZUh0028387; Mon, 22 Jun 2009 01:35:30 -0400 X-Authentication-Warning: gelk.kernelslacker.org: davej set sender to davej@redhat.com using -f Date: Mon, 22 Jun 2009 01:35:30 -0400 From: Dave Jones To: David Miller Cc: netdev@vger.kernel.org Subject: [PATCH v2] Fix velocity driver unmapping incorrect size. Message-ID: <20090622053530.GA28382@redhat.com> References: <20090621173745.GC26093@redhat.com> <20090621.184345.194558005.davem@davemloft.net> <20090622033735.GA9923@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090622033735.GA9923@redhat.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org this makes it even clearer what's going on. diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index b02f7ad..3ba3595 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c @@ -1847,7 +1847,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_ */ if (tdinfo->skb_dma) { - pktlen = (skb->len > ETH_ZLEN ? : ETH_ZLEN); + pktlen = max_t(unsigned int, skb->len, ETH_ZLEN); for (i = 0; i < tdinfo->nskb_dma; i++) { #ifdef VELOCITY_ZERO_COPY_SUPPORT pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], le16_to_cpu(td->tdesc1.len), PCI_DMA_TODEVICE);