Re: [PATCH] MIPS: o32 application running on 64bit kernel core dump

From: Ralf Baechle
Date: Wed Jul 01 2009 - 15:19:54 EST


On Wed, Jul 01, 2009 at 09:35:39AM +0800, Yong Zhang wrote:

> +/* These MUST be defined before elf.h gets included */

This sort of ordering bug seems to become a tradition. I think it may be
a good idea to insert a check like this:

#ifdef ELF_CORE_COPY_REGS
#error ELF_CORE_COPY_REGS should not be defined yet!
#endif

> +extern void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs);
> +#define ELF_CORE_COPY_REGS(_dest, _regs) elf32_core_copy_regs(_dest, _regs);
> +#define ELF_CORE_COPY_TASK_REGS(_tsk, _dest) \
> +({ \
> + int __res = 1; \
> + elf32_core_copy_regs((*_dest), (task_pt_regs(_tsk))); \

Be very careful with parentheses in macros. This line should probably
become:

elf32_core_copy_regs(*(_dest), task_pt_regs(_tsk)); \

The changes to the first argument to bullet prof the macro and the change
to the second one for cosmetic reasons.

Ralf
--
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/