Re: [PATCH v2 2/4] nvme: reject invalid pr_read_keys() num_keys values

Christoph Hellwig
2025-12-02T05:55:34Z

On Mon, Dec 01, 2025 at 11:22:55AM -0500, Stefan Hajnoczi wrote:
> > We use struct_size to calculate the size below, which saturates on
> > overflow. So just checking the rse_len variable returned by the that
> > would be nicer. Bonus points for using sizeof_field() instead of
> > hardcoding U32_MAX.
>
> Will fix. I don't see how to use sizeof_field() here, but taking
> advantage of struct_size() already improves things a lot:

I thought we'd stuff the len in some field, but we actually convert
it to the ndw in the command, so yes it doesn't make sense here.
Sorry for the misleading direction.