Re: [PATCH v2] nvme: fix memory allocation in nvme_pr_read_keys()

From: Dan Carpenter

Date: Sat Mar 21 2026 - 03:19:29 EST


Ah, yes. You're right. It's the nonsense:

if (rse_len > U32_MAX)
return -EINVAL;

check which confused me. Commit a58383fa45c7 ("block: add allocation
size check in blkdev_pr_read_keys()") caps num_keys at 65536 so the
rse_len can't be more than 4MB which is less than INT_MAX (2GB). We
could remove that check.

I will send a patch to do that.

regards,
dan carpenter