Re: [PATCH v3 10/19] nvme: Move NVMe and Block PR types to an array

Keith Busch
2022-10-27T17:16:38Z

On Thu, Oct 27, 2022 at 12:13:06PM -0500, michael.christie@oracle.com wrote:
> Oh wait there was also a
>
> 3. The pr_types come from userspace so if it passes us 10
> and we just do:
>
> types[pr_type]
>
> then we would crash due an out of bounds error.
>
> Similarly I thought there could be a bad target that does the
> same thing.

Well, you'd of course have to check the boundaries before accessing if
you were to implement this scheme. :)

But considering this isn't a performance path, perhaps these kinds of
optimizations are not worth it.