From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcItD-0006fo-P3 for barebox@lists.infradead.org; Wed, 16 Sep 2015 20:01:13 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Wed, 16 Sep 2015 22:00:44 +0200 Message-Id: <1442433644-1324-1-git-send-email-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] video: imx: assert that image buffer doesn't cross a 4 MiB boundary To: barebox@lists.infradead.org VGhlIHJlZmVyZW5jZSBtYW51YWwgKGZvciB0aGUgaS5NWDI1IGluIG15IGNhc2UpIHN0YXRlczoK CglUaGlzIGZpZWxkIG11c3Qgc3RhcnQgYXQgYSBsb2NhdGlvbiB0aGF0IGVuYWJsZXMgYSBjb21w bGV0ZQoJcGljdHVyZSB0byBiZSBzdG9yZWQgaW4gYSA0IE1ieXRlIG1lbW9yeSBib3VuZGFyeSAo QSBbMjE6MF0pLiBBCglbMzE6MjJdIGhhcyBhIGZpeGVkIHZhbHVlIGZvciBhIHBpY3R1cmXigJlz IGltYWdlLgoKQ2hlY2sgdGhpcyBjb25kaXRpb24gZm9yIHVzZXItc3VwcGxpZWQgZnJhbWVidWZm ZXIgdmFsdWVzIGFuZCBlbmZvcmNlIGl0CmZvciBkcml2ZXItYWxsb2NhdGVkIGJ1ZmZlcnMuCgpT aWduZWQtb2ZmLWJ5OiBVd2UgS2xlaW5lLUvDtm5pZyA8dS5rbGVpbmUta29lbmlnQHBlbmd1dHJv bml4LmRlPgotLS0KIGRyaXZlcnMvdmlkZW8vaW14LmMgfCA0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