diff options
Diffstat (limited to 'include/scsi/scsi_host.h')
-rw-r--r-- | include/scsi/scsi_host.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 49084807eb6b..2b6956e9853d 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -873,7 +873,7 @@ static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsign | |||
873 | SHOST_DIF_TYPE2_PROTECTION, | 873 | SHOST_DIF_TYPE2_PROTECTION, |
874 | SHOST_DIF_TYPE3_PROTECTION }; | 874 | SHOST_DIF_TYPE3_PROTECTION }; |
875 | 875 | ||
876 | if (target_type > SHOST_DIF_TYPE3_PROTECTION) | 876 | if (target_type >= ARRAY_SIZE(cap)) |
877 | return 0; | 877 | return 0; |
878 | 878 | ||
879 | return shost->prot_capabilities & cap[target_type] ? target_type : 0; | 879 | return shost->prot_capabilities & cap[target_type] ? target_type : 0; |
@@ -887,7 +887,7 @@ static inline unsigned int scsi_host_dix_capable(struct Scsi_Host *shost, unsign | |||
887 | SHOST_DIX_TYPE2_PROTECTION, | 887 | SHOST_DIX_TYPE2_PROTECTION, |
888 | SHOST_DIX_TYPE3_PROTECTION }; | 888 | SHOST_DIX_TYPE3_PROTECTION }; |
889 | 889 | ||
890 | if (target_type > SHOST_DIX_TYPE3_PROTECTION) | 890 | if (target_type >= ARRAY_SIZE(cap)) |
891 | return 0; | 891 | return 0; |
892 | 892 | ||
893 | return shost->prot_capabilities & cap[target_type]; | 893 | return shost->prot_capabilities & cap[target_type]; |