Re: [PATCH] PCI/MSI: fix msi_mask()

From: Hidetoshi Seto
Date: Sun Feb 08 2009 - 20:38:49 EST


Matthew Wilcox wrote:
> On Thu, Feb 05, 2009 at 11:47:36AM +0900, Hidetoshi Seto wrote:
>> This patch fix the wrong array in the msi_mask().
>
> Quite correct. While disconnected for a couple of weeks, I also
> considered this possible fix:
>
> static inline __attribute_const__ u32 msi_mask(unsigned x)
> {
> /* Don't shift by >= width of type */
> if (x >= 5)
> return 0xffffffff;
> return (1 << (1 << x)) - 1;
> }
>
> which has the added bonus of not running off the end of the array if
> some device has a bogus value in its config space.
>
> What do you think?

Yeah, I think it's better one.
I'm going to post a revised patch hiring this style.

Thanks,
H.Seto

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