From patchwork Fri Dec 11 08:10:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 66566 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nBB8FqvZ019705 for ; Fri, 11 Dec 2009 08:15:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761861AbZLKIPn (ORCPT ); Fri, 11 Dec 2009 03:15:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760919AbZLKIPn (ORCPT ); Fri, 11 Dec 2009 03:15:43 -0500 Received: from mail-gx0-f212.google.com ([209.85.217.212]:55863 "EHLO mail-gx0-f212.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761457AbZLKIPm (ORCPT ); Fri, 11 Dec 2009 03:15:42 -0500 Received: by gxk4 with SMTP id 4so836207gxk.8 for ; Fri, 11 Dec 2009 00:15:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=e49fg0Wx9xMHbhxlEUco3kURrIaOcFyWdhDE1O6TeXQ=; b=J45JDpSg5+4rJ+3aKM0UoIFmTV41lgJ/YzkRnmF2IGKCY991nrGXfc+C7bd4T4UyqV +DkcyfOj9PMu0UjR68vRPSD4M7YxiMhfC/rv/ySQdZ/Lvqd8K4ZhbeAdwURFjr8wIMEq wJWIGlEPVyWteYZ5ecKATCRE5Hn9v+bWSIeJo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=AD9wYRCZR+4pCe9uNiMuRq8urfIcMPn0d1J4lKAl2L1/hbyFh4VLG5SQ+KLmm6oWLM 9JsD8/1mNJd9jQvxQpHjr8R3+AMqSmj0G+CzaT1RmIe/x6cmQXTQ3FpQ83o4TWJ1dfeg Di3kmQYRrNGLHN8mMdUy17lfRCXcoaEXBBxjo= Received: by 10.150.44.24 with SMTP id r24mr1970063ybr.249.1260519348055; Fri, 11 Dec 2009 00:15:48 -0800 (PST) Received: from rxone.opensource.se (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id 15sm769170yxh.40.2009.12.11.00.15.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 11 Dec 2009 00:15:47 -0800 (PST) From: Magnus Damm To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, Magnus Damm , m-karicheri2@ti.com, g.liakhovetski@gmx.de, mchehab@infradead.org Date: Fri, 11 Dec 2009 17:10:06 +0900 Message-Id: <20091211081006.16358.10589.sendpatchset@rxone.opensource.se> Subject: [PATCH] sh_mobile_ceu_camera: Add physical address alignment checks V2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org --- 0010/drivers/media/video/sh_mobile_ceu_camera.c +++ work/drivers/media/video/sh_mobile_ceu_camera.c 2009-12-11 16:52:19.000000000 +0900 @@ -339,7 +339,7 @@ static int sh_mobile_ceu_videobuf_prepar } vb->size = vb->width * vb->height * ((buf->fmt->depth + 7) >> 3); - if (0 != vb->baddr && vb->bsize < vb->size) { + if (0 != vb->baddr && vb->bsize < vb->size && !(vb->width & 3)) { ret = -EINVAL; goto out; } @@ -348,6 +348,13 @@ static int sh_mobile_ceu_videobuf_prepar ret = videobuf_iolock(vq, vb, NULL); if (ret) goto fail; + + /* the physical address must be 32-bit aligned (USERPTR) */ + if (videobuf_to_dma_contig(vb) & 3) { + ret = -EINVAL; + goto fail; + } + vb->state = VIDEOBUF_PREPARED; }