kcalloc/kmalloc_array could BUILD_BUG_ON for too-big constant arguments (was Re: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc)

2015-03-28 Thread Jeff Epler
The following is a sketch of how a macro kcalloc could BUILD_BUG_ON for overflows of two compile-time operands, or call "kcalloc_variable" for nonconstant arguments. Tested on gcc 4.7.2 only, since it's what I had to hand. I didn't do any testing beyond checking that fn2 didn't build, and that fn

[PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc

2015-03-26 Thread Michael Opdenacker
This replaces kmalloc + memset by a call to kzalloc This also fixes one checkpatch.pl issue in the process. This improvement was suggested by "make coccicheck" Signed-off-by: Michael Opdenacker Reviewed-by: Hannes Reinecke --- drivers/scsi/aic7xxx/aic79xx_core.c | 3 +-- drivers/scsi/aic7xxx

Re: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc

2015-03-26 Thread Michael Opdenacker
On 03/24/2015 04:16 PM, Elliott, Robert (Server Storage) wrote: > > It was a reply to the original post on 2014-10-16, not the resend > this month. > > From http://permalink.gmane.org/gmane.linux.kernel/1808168: > > kcalloc is helpful when one of the values is a variable that > might cause the mu

RE: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc

2015-03-24 Thread Elliott, Robert (Server Storage)
.org > Subject: Re: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc > > On Tue, 2015-03-24 at 13:46 -0700, Michael Opdenacker wrote: ... > > On 03/22/2015 11:59 PM, Hannes Reinecke wrote: > > > On 03/22/2015 05:31 PM, Michael Opdenacker wrote: > > >&g

Re: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc

2015-03-24 Thread Joe Perches
On Tue, 2015-03-24 at 13:46 -0700, Michael Opdenacker wrote: > Hi, > > On 03/22/2015 11:59 PM, Hannes Reinecke wrote: > > On 03/22/2015 05:31 PM, Michael Opdenacker wrote: > >> This replaces kmalloc + memset by a call to kzalloc > >> (or kcalloc when appropriate, which zeroes memory too) > >> > >>

Re: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc

2015-03-24 Thread Michael Opdenacker
Hi, On 03/22/2015 11:59 PM, Hannes Reinecke wrote: > On 03/22/2015 05:31 PM, Michael Opdenacker wrote: >> This replaces kmalloc + memset by a call to kzalloc >> (or kcalloc when appropriate, which zeroes memory too) >> >> This also fixes one checkpatch.pl issue in the process. >> >> This improveme

Re: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc

2015-03-23 Thread Hannes Reinecke
On 03/22/2015 05:31 PM, Michael Opdenacker wrote: > This replaces kmalloc + memset by a call to kzalloc > (or kcalloc when appropriate, which zeroes memory too) > > This also fixes one checkpatch.pl issue in the process. > > This improvement was suggested by "make coccicheck" > > Signed-off-by:

[PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc

2015-03-22 Thread Michael Opdenacker
This replaces kmalloc + memset by a call to kzalloc (or kcalloc when appropriate, which zeroes memory too) This also fixes one checkpatch.pl issue in the process. This improvement was suggested by "make coccicheck" Signed-off-by: Michael Opdenacker --- drivers/scsi/aic7xxx/aic79xx_core.c | 3