Re: blktrace segfault.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 28, Aneesh Kumar K.V wrote:

>
> the below diff fix the same.
>
> diff --git a/blktrace.c b/blktrace.c
> index 42613a7..4f4fcde 100644
> --- a/blktrace.c
> +++ b/blktrace.c
> @@ -1220,6 +1220,7 @@ static int start_devices(void)
> 	size = ncpus * sizeof(struct thread_information);
> 	thread_information = malloc(size * ndevs);
> +	memset(thread_information, 0, size*ndevs);
> 	if (!thread_information) {
> 		fprintf(stderr, "Out of memory, threads (%d)\n", size * ndevs);
> 		return 1;

I'm pretty sure you want to make the memset after the NULL-pointer check. If
malloc fails this is segfaulting too.
-
To unsubscribe from this list: send the line "unsubscribe linux-btrace" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux