From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.phycard.co.uk ([217.6.246.34] helo=root.phytec.de) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ya49w-0008DC-PW for barebox@lists.infradead.org; Mon, 23 Mar 2015 15:20:58 +0000 Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id 67778A00226 for ; Mon, 23 Mar 2015 16:21:30 +0100 (CET) From: =?UTF-8?q?Teresa=20G=C3=A1mez?= Date: Mon, 23 Mar 2015 16:17:33 +0100 Message-Id: <1427123853-26983-2-git-send-email-t.gamez@phytec.de> In-Reply-To: <1427123853-26983-1-git-send-email-t.gamez@phytec.de> References: <1427123853-26983-1-git-send-email-t.gamez@phytec.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] lib/lzo: port lzo fix from upstream kernel To: barebox@lists.infradead.org RnJvbTogU3RlZmFuIE3DvGxsZXItS2xpZXNlciA8cy5tdWVsbGVyLWtsaWVzZXJAcGh5dGVjLmRl PgoKVGhpcyBwb3J0cyBjb21taXQgNzJjZjkwMTI0ZTg3ZDk3NWQwYiBmcm9tIG1haW5saW5lIGtl cm5lbCB0byB0aGUKYmFyZWJveC4gV2Ugd2VyZSBleHBlcmllbmNpbmcgcmVwcm9kdWNpYmxlIGJv b3QgaGFuZyB1cHMgb24gb25lIGFtMzM1eApib2FyZCB3aGljaCBkZXBlbmRlZCBvbiB0aGUgYmFy ZWJveC56IHNpemUuIFRoZSBNTE8gd2FzIHRyYXBwZWQgaW4gdGhlCmRlY29tcHJlc3Npb24gY29k ZS4gV2UgZm91bmQgc29tZSBidWcgcmVwb3J0cyBhcm91bmQgdGhlIGx6bwpkZWNvbXByZXNz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