From patchwork Wed Dec 9 13:07:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 65984 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 nB9DDD2b022754 for ; Wed, 9 Dec 2009 13:13:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755673AbZLINMv (ORCPT ); Wed, 9 Dec 2009 08:12:51 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755674AbZLINMu (ORCPT ); Wed, 9 Dec 2009 08:12:50 -0500 Received: from mail-yx0-f187.google.com ([209.85.210.187]:51015 "EHLO mail-yx0-f187.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755620AbZLINMq (ORCPT ); Wed, 9 Dec 2009 08:12:46 -0500 Received: by yxe17 with SMTP id 17so5872230yxe.33 for ; Wed, 09 Dec 2009 05:12:53 -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=roXCT91ss2nGHTJXDvzS9zEwSaj/6kWpdRwTiWyvUuo=; b=NRojY7EyILRtx2+tH7ESa8fb7QOsep/PLIH501f2JXBDWpLlW1+3wmPKFn9qgOZVPU GKtfzcb9sbpZWf5AO4psyE9RnapPqNTW9r+hqab/Vu2zAJ+6/bX2rBcHvHJBQTn+zGPa HFlSsbJ9N5QEaY9tCBgkUAHT0ke86TVHp+SKY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=G4XTfw6trHGRSMUR3Pqxcoz0DXV7VW+Me2IjjEhkFUPIpAzfEQtEHLZCFKWvWIGen3 uyITBFcfPF27SEx/0CZPh/cnDFeWJc7VH8Q70vwulEXGg/WPixY4wlSPCoEp6hfm3TKi xhDc75R6OQQXzihzzYUiwlMxVi1PFSVEELufI= Received: by 10.150.102.25 with SMTP id z25mr16322767ybb.324.1260364373155; Wed, 09 Dec 2009 05:12:53 -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 21sm3451474yxe.19.2009.12.09.05.12.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 09 Dec 2009 05:12:51 -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: Wed, 09 Dec 2009 22:07:12 +0900 Message-Id: <20091209130712.32292.81708.sendpatchset@rxone.opensource.se> Subject: [PATCH] sh_mobile_ceu_camera: Add physical address alignment checks Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org --- 0001/drivers/media/video/sh_mobile_ceu_camera.c +++ work/drivers/media/video/sh_mobile_ceu_camera.c 2009-12-09 17:16:47.000000000 +0900 @@ -278,9 +278,14 @@ static int sh_mobile_ceu_capture(struct phys_addr_top = videobuf_to_dma_contig(pcdev->active); ceu_write(pcdev, CDAYR, phys_addr_top); + if (phys_addr_top & 3) + return -EINVAL; + if (pcdev->is_interlaced) { phys_addr_bottom = phys_addr_top + icd->user_width; ceu_write(pcdev, CDBYR, phys_addr_bottom); + if (phys_addr_bottom & 3) + return -EINVAL; } switch (icd->current_fmt->fourcc) { @@ -288,13 +293,16 @@ static int sh_mobile_ceu_capture(struct case V4L2_PIX_FMT_NV21: case V4L2_PIX_FMT_NV16: case V4L2_PIX_FMT_NV61: - phys_addr_top += icd->user_width * - icd->user_height; + phys_addr_top += icd->user_width * icd->user_height; ceu_write(pcdev, CDACR, phys_addr_top); + if (phys_addr_top & 3) + return -EINVAL; + if (pcdev->is_interlaced) { - phys_addr_bottom = phys_addr_top + - icd->user_width; + phys_addr_bottom = phys_addr_top + icd->user_width; ceu_write(pcdev, CDBCR, phys_addr_bottom); + if (phys_addr_bottom & 3) + return -EINVAL; } }