On Thu, Jan 30, 2025 at 07:51:15PM +0000, Weinan Liu wrote:
> Nit: swap() might be a simplify way to alternate pointers between two
> fre_addr[] entries.
> 
> For example,
> 
> static __always_inline int __find_fre(struct sframe_section *sec,
>                                     struct sframe_fde *fde, unsigned long ip,
>                                     struct unwind_user_frame *frame)
> {
>       /* intialize fres[] with invalid value */
>       struct sframe_fre fres[2] = {0};
>       struct sframe_fre *fre = &fres[1], *prev_fre = fres;
> 
>       for (i = 0; i < fde->fres_num; i++) {
>               swap(fre, next_fre);
>               ret = __read_fre(sec, fde, fre_addr, fre);

Problem is, if it breaks out early here on the first iteration:

>               if (fre->ip_off > ip_off)
>                       break;
>       }
> 
>       if (fre->size == 0)
>               return -EINVAL;

Then fre isn't valid even though it has a nonzero size.

-- 
Josh

Reply via email to