Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1611055

Re: [PATCH 1/2] crypto: ccp - Reduce stack frame size with KASAN

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] crypto: ccp - Reduce stack frame size with KASAN
Date 2017-03-28 17:10 +0200
Message-ID <tq0UV-12M-9@gated-at.bofh.it> (permalink)
References <tpWeC-62o-21@gated-at.bofh.it> <tq0UV-12M-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Mar 28, 2017 at 4:15 PM, Gary R Hook <ghook@amd.com> wrote:

>> A more drastic refactoring of the driver might be needed to reduce the
>> stack usage more substantially, but this patch is fairly simple and
>> at least addresses the third one of the problems I mentioned, reducing the
>> stack size by about 150 bytes and bringing it below the warning limit
>> I picked.
>
>
> Again, I'll devote some time to this.
>
>> diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h
>> index 3a45c2af2fbd..c5ea0796a891 100644
>> --- a/drivers/crypto/ccp/ccp-dev.h
>> +++ b/drivers/crypto/ccp/ccp-dev.h
>> @@ -432,24 +432,24 @@ struct ccp_dma_info {
>>          unsigned int offset;
>>          unsigned int length;
>>          enum dma_data_direction dir;
>> -};
>> +} __packed __aligned(4);
>
>
> My gcc 4.8 doesn't understand __aligned(). Shouldn't we use
> #pragma(4) here?



>>  struct ccp_dm_workarea {
>>          struct device *dev;
>>          struct dma_pool *dma_pool;
>> -       unsigned int length;
>>
>>          u8 *address;
>>          struct ccp_dma_info dma;
>> +       unsigned int length;
>>  };
>>
>>  struct ccp_sg_workarea {
>>          struct scatterlist *sg;
>>          int nents;
>> +       unsigned int dma_count;
>>
>>          struct scatterlist *dma_sg;
>>          struct device *dma_dev;
>> -       unsigned int dma_count;
>>          enum dma_data_direction dma_dir;
>>
>>          unsigned int sg_used;
>
>
> I'm okay with rearranging, but I'm going to submit an alternative patch.

Ok, thanks a lot!

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] crypto: ccp - Reduce stack frame size with KASAN Arnd Bergmann <arnd@arndb.de> - 2017-03-28 12:10 +0200
  [PATCH 2/2] crypto: ccp - Mark driver as little-endian only Arnd Bergmann <arnd@arndb.de> - 2017-03-28 12:10 +0200
    Re: [PATCH 2/2] crypto: ccp - Mark driver as little-endian only Arnd Bergmann <arnd@arndb.de> - 2017-03-28 17:10 +0200
  Re: [PATCH 1/2] crypto: ccp - Reduce stack frame size with KASAN Arnd Bergmann <arnd@arndb.de> - 2017-03-28 17:10 +0200
  Re: [PATCH 1/2] crypto: ccp - Reduce stack frame size with KASAN Arnd Bergmann <arnd@arndb.de> - 2017-03-28 17:20 +0200

csiph-web