> -----Original Message----- > From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> > Sent: Thursday, September 24, 2020 2:36 PM > To: Van Leeuwen, Pascal <pvanleeuwen@xxxxxxxxxx> > Cc: linux-crypto@xxxxxxxxxxxxxxx; antoine.tenart@xxxxxxxxxxx; davem@xxxxxxxxxxxxx; Ard Biesheuvel <ardb@xxxxxxxxxx> > Subject: Re: [PATCH] crypto: inside-secure - Fix corruption on not fully coherent systems > > <<< External Email >>> > On Thu, Sep 24, 2020 at 08:08:12AM +0000, Van Leeuwen, Pascal wrote: > > > > The fact that kmalloc uses it does _not_ rule out the fact that it wastes memory ... > > And as long as you use kmalloc for fairly large data structures, it shouldn't matter much. > > But here I need a couple of fairly small buffers. > > Those small buffers are embedded in a structure that's already > aligned by kmalloc. So just put your buffers at the start of > the struct to minimise holes. > If you would make them fixed in size, then putting them at the start instead of the end would indeed by a bit more efficient (but obviously, that doesn't work if you dynamically scale them), I'll remember that. But you still have 2 potential gaps (from buffer 1 to buffer 2 and from buffer 2 to the other items in the struct) that are larger then they may need to be. If everyone can live with the wasted space, it's fine by me. (frankly, I don't know where these structs may end up - guess not on the minimal kernel stack then?) I only did it this way because I anticipated that that would be accepted ... guess I could've save myself some trouble there :-) Regards, Pascal van Leeuwen Silicon IP Architect Multi-Protocol Engines, Rambus Security Rambus ROTW Holding BV +31-73 6581953 Note: The Inside Secure/Verimatrix Silicon IP team was recently acquired by Rambus. Please be so kind to update your e-mail address book with my new e-mail address. > Cheers, > -- > Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ** This message and any attachments are for the sole use of the intended recipient(s). It may contain information that is confidential and privileged. If you are not the intended recipient of this message, you are prohibited from printing, copying, forwarding or saving it. Please delete the message and attachments and notify the sender immediately. ** Rambus Inc.<http://www.rambus.com>