Re: [PATCH] drivers: scsi: fix shift-out-of-bounds in sg_build_indirect

From: Bart Van Assche
Date: Mon Apr 15 2024 - 13:26:39 EST


On 4/14/24 20:14, Sam Sun wrote:
- num = scatter_elem_sz;
+ num = max(scatter_elem_sz, PAGE_SIZE);

Shouldn't the following statements be modified instead of the above
statement? I think these are the only statements that can cause
scatter_elem_sz to become smaller than PAGE_SIZE:

scatter_elem_sz = ret_sz;
scatter_elem_sz_prev = ret_sz;

Thanks,

Bart.