Possible bug in SMP top

Denys Vlasenko vda.linux at googlemail.com
Thu Sep 6 10:44:24 UTC 2012


On Tue, Sep 4, 2012 at 12:26 PM, Ståle Kristoffersen
<staalebk at ifi.uio.no> wrote:
> Hi, I have noticed a problem with top on a powerpc-based SMP system. The
> 'CPU' column is always 0.
>
> Looking at the source it looks like there is a bug when checking the return
> code of sscanf in procps.c. The patch following this e-mail seems to fix the
> issue for me, and makes more sense seeing as we are passing 12 elements to
> sscanf.
>
> --
> Ståle Kristoffersen
> staalebk at ifi.uio.no
>
> diff --git a/libbb/procps.c b/libbb/procps.c
> index 40587db..348620d 100644
> --- a/libbb/procps.c
> +++ b/libbb/procps.c
> @@ -425,7 +425,7 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
>                         if (n < 11)
>                                 continue; /* bogus data, get next /proc/XXX */
>  # if ENABLE_FEATURE_TOP_SMP_PROCESS
> -                       if (n < 11+15)
> +                       if (n < 12)
>                                 sp->last_seen_on_cpu = 0;
>  # endif


Thanks!
n == 11 check will work better here, though...

-- 
vda


More information about the busybox mailing list