[PATCH] Use calloc (x, y) instead malloc (x * y).

Siddhesh Poyarekar siddhesh@redhat.com
Fri Oct 25 08:53:00 GMT 2013


On Fri, Oct 25, 2013 at 10:40:08AM +0200, Ondřej Bílka wrote:
> Hi,
> 
> As there were several bugs with possible overflows in malloc calculation
> we should try to prevent these. A simple heuristic is to use following
> cocinelle patch:
> 
> @@ expression e1, e2; @@
> 
> - malloc(e1 * e2)
> + calloc(e1, e2)
> 
> To handle easy case. OK to commit?
> 
> ./ChangeLog:
> 

Please write correct ChangeLog entries, with entries for all functions
you touch and not just for the files.  If you think it is a waste of
time, I'll agree with you, but since we don't have consensus on
getting rid of it yet, this needs to be followed.

Siddhesh



More information about the Libc-alpha mailing list