From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Subject: dmaengine: dmatest: Remove use of VLAs From: Vinod Koul Message-Id: <20180410153854.GT6014@localhost> Date: Tue, 10 Apr 2018 21:08:55 +0530 To: Laura Abbott Cc: Sinan Kaya , Dan Williams , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Kees Cook List-ID: T24gTW9uLCBBcHIgMDksIDIwMTggYXQgMDQ6MTQ6MjBQTSAtMDcwMCwgTGF1cmEgQWJib3R0IHdy b3RlOgo+IE9uIDA0LzA5LzIwMTggMDM6NDggUE0sIFNpbmFuIEtheWEgd3JvdGU6Cj4gPk9uIDQv OS8yMDE4IDU6MDYgUE0sIExhdXJhIEFiYm90dCB3cm90ZToKPiA+PisJCQkvKiBkc3RfY250IGNh bid0IGJlIG1vcmUgdGhhbiB1OCAqLwo+ID4+KwkJCWRtYV9hZGRyX3QgZG1hX3BxWzI1NV07Cj4g Pgo+ID5UaGlzIGlzIDJrIHN0YWNrIHNwYWNlIG9uIDY0IGJpdCBhcmNoaXRlY3R1cmVzLiBJc24n dCB0aGF0IGEgbG90Pwo+ID4KPiAKPiBEZXBlbmRzIG9uIHlvdXIgZGVmaW5pdGlvbiBvZiAnYSBs b3QnLiBNeSBhc3N1bXB0aW9uIHdhcyB0aGF0Cj4gc2luY2UgdGhpcyB3YXMgYSB0ZXN0IG1vZHVs ZSB0aGVyZSB3b3VsZCBiZSBzb21lIHdpbGxpbmduZXNzCj4gdG8gYmUgYSBiaXQgbW9yZSBnZW5l cm91cy4gVGhlIHByb2JsZW0gaXMgdGhlIGFycmF5IHNpemUgaXMKPiBiYXNlZCBvZmYgb2YgdGhl IHBhcmFtZXRlcnMgcGFzc2VkIGluLCBhbHRob3VnaCBvZGRseSBlbm91Z2gKPiBpdCdzIGJhc2Vk IG9mZiBvZiB0aGUgbWluaW11bSBvZiB0d28gdmFyaWFibGVzLiBJZiB5b3UgaGF2ZQo+IGEgc3Vn Z2VzdGlvbiBmb3IgYSB0aWdodGVyIGJvdW5kIHdlIGNhbiB1c2UgdGhhdC4gQW5vdGhlcgo+IG9w dGlvbiBpcyB0byBqdXN0IHN3aXRjaCB0byBhbGxvY2F0aW5nIHRoZSBhcnJheSB3aXRoIGttYWxs b2MuCj4gVGhhdCBtaWdodCBiZSByZWFzb25hYmxlIGhlcmUgc2luY2UgdGhlcmUncyBvdGhlciBz ZXR1cAo+IHRoYXQgaGFwcGVucyBiZWZvcmUgdGhlIHRlc3Qgc3RhcnRzLgoKQmVpbmcgYSB0ZXN0 IG1vZHVsZSBJIGRvbid0IHRoaW5rIEkgd291bGQgaGF2ZSB0b28gbWFueSBxdWFsbXMgd2l0aCBj dXJyZW50CmFwcHJvYWNoIDopIHNhaWQgdGhhdCBrbWFsbG9jIGFwcHJvYWNoIHNlZW1zIHJlYXNv bmFibGUgdG9vLi4KClRoYW5rcwo= From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Tue, 10 Apr 2018 21:08:55 +0530 From: Vinod Koul Subject: Re: [PATCH] dmaengine: dmatest: Remove use of VLAs Message-ID: <20180410153854.GT6014@localhost> References: <20180409210603.3575-1-labbott@redhat.com> <4491bde2-cf38-5103-0634-1986ecd32a7c@codeaurora.org> <9bdd8bb4-b6d9-e170-b585-b2dc3b8f0d67@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9bdd8bb4-b6d9-e170-b585-b2dc3b8f0d67@redhat.com> To: Laura Abbott Cc: Sinan Kaya , Dan Williams , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Kees Cook List-ID: On Mon, Apr 09, 2018 at 04:14:20PM -0700, Laura Abbott wrote: > On 04/09/2018 03:48 PM, Sinan Kaya wrote: > >On 4/9/2018 5:06 PM, Laura Abbott wrote: > >>+ /* dst_cnt can't be more than u8 */ > >>+ dma_addr_t dma_pq[255]; > > > >This is 2k stack space on 64 bit architectures. Isn't that a lot? > > > > Depends on your definition of 'a lot'. My assumption was that > since this was a test module there would be some willingness > to be a bit more generous. The problem is the array size is > based off of the parameters passed in, although oddly enough > it's based off of the minimum of two variables. If you have > a suggestion for a tighter bound we can use that. Another > option is to just switch to allocating the array with kmalloc. > That might be reasonable here since there's other setup > that happens before the test starts. Being a test module I don't think I would have too many qualms with current approach :) said that kmalloc approach seems reasonable too.. Thanks -- ~Vinod