From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-io0-x243.google.com ([2607:f8b0:4001:c06::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f7O0B-00075q-Td for barebox@lists.infradead.org; Sat, 14 Apr 2018 16:26:13 +0000 Received: by mail-io0-x243.google.com with SMTP id y128so13455666iod.4 for ; Sat, 14 Apr 2018 09:26:00 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20180413233053.15570-4-u.kleine-koenig@pengutronix.de> References: <20180413233053.15570-1-u.kleine-koenig@pengutronix.de> <20180413233053.15570-4-u.kleine-koenig@pengutronix.de> From: Andrey Smirnov Date: Sat, 14 Apr 2018 09:25:59 -0700 Message-ID: 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: Re: [PATCH 4/4] pci: don't hide hard to understand sanity check in size calculation To: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Cc: Barebox List T24gRnJpLCBBcHIgMTMsIDIwMTggYXQgNDozMCBQTSwgVXdlIEtsZWluZS1Lw7ZuaWcKPHUua2xl aW5lLWtvZW5pZ0BwZW5ndXRyb25peC5kZT4gd3JvdGU6Cj4gcGNpX3NpemUoKSBoYWQgYSBjaGVj ayB0aGF0IG1hZGUgaXQgcmV0dXJuIDAgKGkuZS4gYW4gZXJyb3IpIGluIHNvbWUKPiBjYXNlcy4g SXQgdG9vayBtZSBhIHdoaWxlIHRvIHdvcmsgb3V0IGluIHdoaWNoIHNpdHVhdGlvbnMgZXhhY3Rs eSB0aGlzCj4gY2hlY2sgdHJpZ2dlcmVkOiBJZiB3cml0aW5nIDB4ZmZmZmZmZmUgdG8gdGhlIEJB UiByZWdpc3RlciBkb2Vzbid0Cj4gY2hhbmdlIGl0J3MgdmFsdWUgYW5kIHRoZ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AgICAg ICAgICAgICAgIGNvbnN0IGNoYXIgKnR5cGU7Cj4gICAgICAgICAgICAgICAgIGludCByZXN0eXBl Owo+ICAgICAgICAgICAgICAgICB1bnNpZ25lZCBsb25nIHJlc2ZsYWdzOwo+IEBAIC0yMDYsMTMg KzE5OCwxOSBAQCBzdGF0aWMgdm9pZCBzZXR1cF9kZXZpY2Uoc3RydWN0IHBjaV9kZXYgKmRldiwg aW50IG1heF9iYXIpCj4gICAgICAgICAgICAgICAgICAgICAgICAgbGFzdCA9ICZsYXN0X21lbTsK PiAgICAgICAgICAgICAgICAgfQo+Cj4gLSAgICAgICAgICAgICAgIHNpemUgPSBwY2lfc2l6ZShv cmlnLCBiYXJ2YWwsIG1hc2spOwo+IC0gICAgICAgICAgICAgICBpZiAoIXNpemUpIHsKPiAtICAg ICAgICAgICAgICAgICAgICAgICBwcl9kZWJ1ZygiIHBiYXIlZDogYmFkICVzIHNpemUgKG9yaWc9 JTA4eCwgYmFydmFsPSUwOHgsIHR5cGU9JXMpXG4iLAo+IC0gICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIGJhciwgdHlwZSwgb3JpZywgYmFydmFsLCB0eXBlKTsKPiArICAgICAgICAgICAg ICAgbWF4YmFzZSA9IGJhcnZhbCAmIG1hc2s7Cj4gKwo+ICsgICAgICAgICAgICAgICAvKgo+ICsg ICAgICAgICAgICAgICAgKiBpZiBtYXhiYXNlIGlzbid0IGluIHRoZSBmb3JtIDBiMS4uLjEwLi4u MCB0aGVyZSBpcyBzb21ldGhpbmcKPiArICAgICAgICAgICAgICAgICogZmlzaHkKPiArICAgICAg ICAgICAgICAgICovCj4gKyAgICAgICAgICAgICAgIGlmICgobWF4YmFzZSB8IChtYXhiYXNlIC0g MSkpICE9ICh1MzIpLTEgfHwgbWF4YmFzZSA9PSAwKSB7CgpVMzJfTUFYIGluc3RlYWQgb2YgKHUz MiktMSA/CgpUaGFua3MsCkFuZHJleSBTbWlybm92CgpfX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fXwpiYXJlYm94IG1haWxpbmcgbGlzdApiYXJlYm94QGxpc3Rz LmluZnJhZGVhZC5vcmcKaHR0cDovL2xpc3RzLmluZnJhZGVhZC5vcmcvbWFpbG1hbi9saXN0aW5m by9iYXJlYm94Cg==