diff options
| -rw-r--r-- | drivers/scsi/scsi_lib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 43318d556cbc..9ea95dd3e260 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -1918,7 +1918,9 @@ static int scsi_mq_prep_fn(struct request *req) | |||
| 1918 | 1918 | ||
| 1919 | if (scsi_host_get_prot(shost)) { | 1919 | if (scsi_host_get_prot(shost)) { |
| 1920 | cmd->prot_sdb = (void *)sg + | 1920 | cmd->prot_sdb = (void *)sg + |
| 1921 | shost->sg_tablesize * sizeof(struct scatterlist); | 1921 | min_t(unsigned int, |
| 1922 | shost->sg_tablesize, SCSI_MAX_SG_SEGMENTS) * | ||
| 1923 | sizeof(struct scatterlist); | ||
| 1922 | memset(cmd->prot_sdb, 0, sizeof(struct scsi_data_buffer)); | 1924 | memset(cmd->prot_sdb, 0, sizeof(struct scsi_data_buffer)); |
| 1923 | 1925 | ||
| 1924 | cmd->prot_sdb->table.sgl = | 1926 | cmd->prot_sdb->table.sgl = |
