Il 18/08/2014 11:50, Wanpeng Li ha scritto:
> +     if (msr >= 0x200 && msr < 0x200 + 2 * KVM_NR_VAR_MTRR) {

This should be a WARN_ON, and the base/mask can be separated just with
an "&".

        WARN_ON(!(msr >= 0x200 && msr < 0x200 + 2 * KVM_NR_VAR_MTRR));

        if ((msr & 1) == 0)
                /* MTRR base */
                return valid_mtrr_type(data & 0xff);

        /* MTRR mask */
        return true;

Please provide a unit test for this patch and for patch 1.

Paolo

> +             int idx, is_mtrr_mask;
> +
> +             idx = (msr - 0x200) / 2;
> +             is_mtrr_mask = msr - 0x200 - 2 * idx;
> +             if (!is_mtrr_mask)
> +                     return valid_mtrr_type(data & 0xff);
> +     }
> +     return true;
>  }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to