From patchwork Thu Oct 7 12:45:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 238171 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o97CmFqw011661 for ; Thu, 7 Oct 2010 12:48:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755355Ab0JGMsM (ORCPT ); Thu, 7 Oct 2010 08:48:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58538 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754057Ab0JGMsL (ORCPT ); Thu, 7 Oct 2010 08:48:11 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o97CmBpY022767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 7 Oct 2010 08:48:11 -0400 Received: from pedra (vpn-225-63.phx2.redhat.com [10.3.225.63]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o97Ck4si028624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Thu, 7 Oct 2010 08:48:10 -0400 Date: Thu, 7 Oct 2010 09:45:43 -0300 From: Mauro Carvalho Chehab Cc: Linux Media Mailing List Subject: [PATCH 1/3] V4L/DVB: videobuf-dma-sg: Use min_t(size_t, PAGE_SIZE ..) Message-ID: <20101007094543.47b77328@pedra> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 07 Oct 2010 12:48:15 +0000 (UTC) diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 7153e44..20f227e 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c @@ -116,8 +116,8 @@ static struct scatterlist *videobuf_pages_to_sg(struct page **pages, goto nopage; if (PageHighMem(pages[i])) goto highmem; - sg_set_page(&sglist[i], pages[i], min((unsigned)PAGE_SIZE, size), 0); - size -= min((unsigned)PAGE_SIZE, size); + sg_set_page(&sglist[i], pages[i], min_t(size_t, PAGE_SIZE, size), 0); + size -= min_t(size_t, PAGE_SIZE, size); } return sglist;