struct cf_trailer_entry *trailer_start, *trailer_stop;
        struct cf_ctrset_entry *ctrstart, *ctrstop;
        size_t offset = 0;
+       int i;
 
-       auth &= (1 << CPUMF_LCCTL_ENABLE_SHIFT) - 1;
-       do {
+       for (i = CPUMF_CTR_SET_BASIC; i < CPUMF_CTR_SET_MAX; ++i) {
                ctrstart = (struct cf_ctrset_entry *)(cpuhw->start + offset);
                ctrstop = (struct cf_ctrset_entry *)(cpuhw->stop + offset);
 
+               /* Counter set not authorized */
+               if (!(auth & cpumf_ctr_ctl[i]))
+                       continue;
+               /* Counter set size zero was not saved */
+               if (!cpum_cf_read_setsize(i))
+                       continue;
+
                if (memcmp(ctrstop, ctrstart, sizeof(*ctrstop))) {
                        pr_err_once("cpum_cf_diag counter set compare error "
                                    "in set %i\n", ctrstart->set);
                        return 0;
                }
-               auth &= ~cpumf_ctr_ctl[ctrstart->set];
                if (ctrstart->def == CF_DIAG_CTRSET_DEF) {
                        cfdiag_diffctrset((u64 *)(ctrstart + 1),
                                          (u64 *)(ctrstop + 1), ctrstart->ctr);
                        offset += ctrstart->ctr * sizeof(u64) +
                                                        sizeof(*ctrstart);
                }
-       } while (ctrstart->def && auth);
+       }
 
        /* Save time_stamp from start of event in stop's trailer */
        trailer_start = (struct cf_trailer_entry *)(cpuhw->start + offset);