Re: [PATCH] ramoops: scripts/ramoops.c for extracting oopses

From: Srivatsa S. Bhat
Date: Wed Oct 05 2011 - 16:32:35 EST


Hi,

On 10/05/2011 11:55 PM, Thomas Tuttle wrote:
> +static int print_records(int record)
> +{
> + unsigned long mem_address, mem_size, record_size, num_records;
> + FILE *mem;
> + int i;
> + int ret = 0;
> +
> + read_long(RAMOOPS_PARAM "mem_address", &mem_address);
> + read_long(RAMOOPS_PARAM "mem_size", &mem_size);
> + read_long(RAMOOPS_PARAM "record_size", &record_size);
> + num_records = mem_size / record_size;
> +
> + if (record != REC_LIST &&
> + (record < 0 || (unsigned long)record >= num_records)) {
> + fprintf(stderr, "%s: record number %d out of range [0, %ld)\n",
> + progn, record, num_records);
> + return 1;
> + }
> +
> + buf = malloc(record_size);

Since buf is not declared, this fails program compilation.

> + if (!buf) {
> + fprintf(stderr, "%s: failed to allocate record buffer\n",
> + progn);
> + return 1;
> + }
> +

--
Regards,
Srivatsa S. Bhat <srivatsa.bhat@xxxxxxxxxxxxxxxxxx>
Linux Technology Center,
IBM India Systems and Technology Lab
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/