[PATCH] nvme: Fix discard buffer overrun

jianchao.wang jianchao.w.wang at oracle.com
Thu Feb 1 07:07:15 PST 2018


Hi Keith

Thanks for your kindly response.

On 02/01/2018 11:05 PM, Keith Busch wrote:
> On Thu, Feb 01, 2018 at 10:55:30PM +0800, jianchao.wang wrote:
>> Hi Keith
>>
>> Since each discard bio merged into a request is counted as one segment,
>> why not let blk_rq_nr_discard_segments return numbers of bios directly.
> 
> Right, I'm all for fixing the discard segment count. At the same time,
> I don't want to depend on it's correctness to not access out-of-bounds
> array indices.
> 
Actually, if we use iterating request bio list to return discard segments count,
we won't have any out-of-bounds error any more. And things will be simpler. :)

Thanks
Jianchao



More information about the Linux-nvme mailing list