[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH,Hurd] Fix deallocation after proc_getprocinfo call
From: |
Samuel Thibault |
Subject: |
Re: [PATCH,Hurd] Fix deallocation after proc_getprocinfo call |
Date: |
Sun, 23 Nov 2014 10:13:47 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Joel Brobecker, le Sun 23 Nov 2014 11:44:52 +0400, a écrit :
> > - vm_deallocate (mach_task_self (), (vm_address_t) pi, pi_len);
> > + vm_deallocate (mach_task_self (), (vm_address_t) pi, pi_len * sizeof
> > (*(procinfo_t) 0));
>
> Suggest using "sizeof (struct procinfo)", which I think is better
> than dereferencing a NULL pointer. This is based on guessing that
> type procinfo_t is a pointer to struct procinfo, as suggested by
> the code in inf_validate_procinfo.
Not, that is not the same: struct procinfo has an open array at its end
(threadinfos[0]), and thus the actually allocated size is variable.
Samuel