Re: [RFC, PATCH 4/4] elf_core_dump(): Add extended numberingsupport

From: Daisuke HATAYAMA
Date: Tue Dec 15 2009 - 21:24:17 EST



I agree with two of three cleanup ideas, but the last.

> > @@ -2079,11 +2139,19 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
> >        if (!elf_core_write_extra_data(file, &size, limit))
> >                goto end_coredump;
> >
> > +       if (e_phnum == PN_XNUM) {
> > +               size += sizeof(*shdr4extnum);
> > +               if (size > limit
> > +                   || !dump_write(file, shdr4extnum, sizeof(*shdr4extnum)))
> > +                       goto end_coredump;
> > +       }
> > +
> >  end_coredump:

There are two reasons I wrote like this.

First, the code like

if (size > limit || !dump_write(file, obj, sizeof(*obj)))
goto end_coredump;

is used as the common idiom in thourghout elf_core_dump(). Not
writing goto only at the last use seems unnatural for me.

Second, there is a possibility that new writing operation for section
header table will be added. If the goto is removed now, the patch
writer must rewrite it again.

Thanks for your comments.
--
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/