[PATCH 3/3] Cleanup: Remove offset_pt_load_memory

Petr Tesarik ptesarik at suse.com
Thu Oct 15 08:00:18 EDT 2020


On Thu, 15 Oct 2020 03:07:59 +0000
HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab at nec.com> wrote:

> -----Original Message-----
> > > -----Original Message-----
> > > After the previous commit, this variable has become write-only, so
> > > it is clearly no longer needed.
> > >
> > > Signed-off-by: Petr Tesarik <ptesarik at suse.com>
> > > ---
> > >  elf_info.c | 17 -----------------
> > >  1 file changed, 17 deletions(-)
> > >
> > > diff --git a/elf_info.c b/elf_info.c
> > > index 5ed65fc..a6624b5 100644
> > > --- a/elf_info.c
> > > +++ b/elf_info.c
> > > @@ -63,7 +63,6 @@ static int			flags_memory;
> > >   */
> > >  static unsigned int		num_pt_loads;
> > >  static struct pt_load_segment	*pt_loads;
> > > -static off_t			offset_pt_load_memory;
> > >
> > >  /*
> > >   * PT_NOTE information about /proc/vmcore:
> > > @@ -843,15 +842,6 @@ int get_kcore_dump_loads(void)
> > >  			return FALSE;
> > >  		}
> > >
> > > -		if (j == 0) {
> > > -			offset_pt_load_memory = p->file_offset;
> > > -			if (offset_pt_load_memory == 0) {
> > > -				ERRMSG("Can't get the offset of page data.\n");
> > > -				free(pls);
> > > -				return FALSE;
> > > -			}
> > > -		}
> > > -
> > >  		pls[j] = *p;
> > >  		j++;
> > >  	}
> > > @@ -929,13 +919,6 @@ get_elf_info(int fd, char *filename)
> > >  		if (phdr.p_type != PT_LOAD)
> > >  			continue;
> > >
> > > -		if (j == 0) {
> > > -			offset_pt_load_memory = phdr.p_offset;
> > > -			if (offset_pt_load_memory == 0) {
> > > -				ERRMSG("Can't get the offset of page data.\n");
> > > -				return FALSE;  
> > 
> > I think this part is a kind of sanity check on ELF Phdr data, but
> > checking only p_offset when j==0 doesn't make sense and there would
> > be extremely rare cases where are aborted by this check, so it would
> > be fine to remove completely.
> > 
> > So the patchset looks good to me.
> > Thank you for the cleanup!  
> 
> Applied.
> https://github.com/makedumpfile/makedumpfile/compare/64d2aee2c4654fa422633a683c1c3f2a8d3bf3a9...master

Thank you.

Petr T




More information about the kexec mailing list