[parisc-linux] Re:[parisc-linux-cvs] linux-2.6 kyle

Matthew Wilcox matthew at wil.cx
Tue Aug 1 09:31:01 MDT 2006


On Tue, Aug 01, 2006 at 05:10:57PM +0200, Joel Soete wrote:
> +++ unwind.c    2006-08-01 16:58:19.000000000 +0200
> @@ -341,16 +341,14 @@
>  void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info,
> struct task_struct *t)
>  {
>         struct pt_regs *r = &t->thread.regs;
> -       struct pt_regs *r2;
> 
> -       r2 = (struct pt_regs *)kmalloc(sizeof(struct pt_regs), GFP_KERNEL);
> -       if (!r2)
> +       if (r == NULL)
>                 return;

How can r *possibly* be NULL?  You've taken the *address* of an offset
from t->thread.  Mind you, I think gcc is smart enough to delete this
useless test these days, but there's still no excuse for writing it.

> -       *r2 = *r;
> -       r2->gr[30] = r->ksp;
> -       r2->iaoq[0] = r->kpc;
> -       unwind_frame_init(info, t, r2);
> -       kfree(r2);
> +       struct pt_regs r2 = *r;

Is this really wise?  pt_regs is *huge* -- 472 bytes on 32-bit and 688
bytes on 64-bit.



More information about the parisc-linux mailing list