[UPDATED PATCH v2 8/8] makedumpfile: Add erase information in ELF formatted dumpfile

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

 



Hi Mahesh,

On Fri, 15 Jul 2011 14:46:02 +0530
Mahesh J Salgaonkar <mahesh at linux.vnet.ibm.com> wrote:
> @@ -4647,6 +4650,15 @@ write_cache_bufsz(struct cache_data *cd)
>  }
>  
>  int
> +write_cache_zero(struct cache_data *cd, size_t size)
> +{
> +	memset(cd->buf + cd->buf_size, 0, size);
> +	cd->buf_size += size;
> +
> +	return write_cache_bufsz(cd);
> +}

if cd->buf_size is a little smaller than cd->cache_size and
the argument "size" is bigger than info->page_size, the above
a SIGSEGV happens at the above memset().

Previous write_cache_bufsze() call will avoid that :
---
 int
 write_cache_zero(struct cache_data *cd, size_t size)
 {
+	if (!write_cache_bufsz(cd))
+		return FALSE;

	memset(cd->buf + cd->buf_size, 0, size);
	cd->buf_size += size;

	return write_cache_bufsz(cd);
 }
---

>  /*
> + * ELF note section for erase information
> + *
> + * According to elf.h the unused values are 0x15(21) through 0xff. The value
> + * range 0x1XX, 0x2XX and 0x3XX is been used for PPC, i386 and s390
> + * respectively.
> + *
> + * Using 0xff to be on safer side so that any new Elf Note addition in elf.h
> + * after 0x15 value would not clash.
> + */
> +#ifndef NT_ERASE_INFO
> +#define NT_ERASE_INFO (0xff)	/* Contains erased information. */
> +#endif
> +#define ERASEINFO_NOTE_NAME		"ERASEINFO"
> +#define ERASEINFO_NOTE_NAME_BYTES	(sizeof(ERASEINFO_NOTE_NAME))

I feel NT_ERASE_INFO(0xff) is not safe and we can use ERASEINFO_NOTE_NAME
instead.


Thanks
Ken'ichi Ohmichi



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux