On 2020/5/29 20:48, Christoph Hellwig wrote:
On Fri, May 29, 2020 at 02:32:51PM +0800, Ye Bin wrote:
index 435781a16875..d674184ed835 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3723,7 +3723,7 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
if (!scsi_sg_count(scmd) || scsi_sglist(scmd)->length < len)
goto invalid_param_len;
- p = page_address(sg_page(scsi_sglist(scmd)));
+ p = page_address(sg_page(scsi_sglist(scmd))) + scsi_sglist(scmd)->offset;
This also looks completely buggy on highmem systems and really needs to
use a kmap_atomic.
.
Thank you for your reply.
As in sg_scsi_ioctl function allocate bio memory by kzalloc. Maybe
it's better to give
the caller more freedom, and at the same time, it's more robust.