[PATCH v2 2/4] nvme: reject invalid pr_read_keys() num_keys values
Christoph Hellwig
hch at lst.de
Mon Dec 1 21:55:30 PST 2025
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.
More information about the Linux-nvme
mailing list