From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aLrM0-0001YY-BV for barebox@lists.infradead.org; Wed, 20 Jan 2016 11:55:13 +0000 Received: by mail-wm0-x244.google.com with SMTP id l65so3589003wmf.3 for ; Wed, 20 Jan 2016 03:54:51 -0800 (PST) References: <1453277701-10367-1-git-send-email-uwe@kleine-koenig.org> From: Sebastian Hesselbarth Message-ID: <569F7587.3040908@gmail.com> Date: Wed, 20 Jan 2016 12:54:47 +0100 In-Reply-To: <1453277701-10367-1-git-send-email-uwe@kleine-koenig.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="utf-8"; Format="flowed" Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH v2] kwboot: do a filetype check before sending the image To: =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , barebox@lists.infradead.org T24gMDEvMjAvMjAxNiAwOToxNSBBTSwgVXdlIEtsZWluZS1Lw7ZuaWcgd3JvdGU6Cj4gVGhlIGlt YWdlcyB0aGF0IGNhbiBiZSBzZW50IHRvIGEgTWFydmVsbCBDUFUgaGF2ZSBhIGZpeGVkIGZvcm1h dC4gRG8KPiBzb21lIHNhbml0eSBjaGVja3MgYmVmb3JlIGFjdHVhbGx5IHNlbmRpbmcgYW4gaW1h Z2UgZm9yIGVhc2llciBkaWFnbm9zaXMKPiBvZiBicm9rZW4gZmlsZXMuCj4KPiBTaWduZWQtb2Zm LWJ5OiBVd2UgS2xlaW5lLUvDtm5pZyA8dXdlQGtsZWluZS1rb2VuaWcub3JnPgo+IC0tLQo+IENo YW5nZXMgc2luY2UgKGltcGxpY2l0KSB2MSwgc2VudCB3aXRoCj4gTWVzc2FnZS1JZDogMTQ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