aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2013-09-18 08:27:28 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-10-25 04:58:12 -0400
commit51d648af5892219cbe97305efb300d3e56746591 (patch)
tree079016b039e35964be71af3c4c3426e42c30efdf
parent68aee7ba66d390abf48c13791a84f6bce29d6f19 (diff)
[SCSI] scsi_debug: fix sparse warnings related to data integrity field
Each member in data integrity field tuple is big-endian. But the endianness of the values being compared with these members are not annotated. So this fixes these sparse warnings. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/scsi_debug.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index a21322d6da61..80b8b10edf41 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1745,25 +1745,22 @@ static int do_device_access(struct scsi_cmnd *scmd,
1745 return ret; 1745 return ret;
1746} 1746}
1747 1747
1748static u16 dif_compute_csum(const void *buf, int len) 1748static __be16 dif_compute_csum(const void *buf, int len)
1749{ 1749{
1750 u16 csum; 1750 __be16 csum;
1751 1751
1752 switch (scsi_debug_guard) { 1752 if (scsi_debug_guard)
1753 case 1: 1753 csum = (__force __be16)ip_compute_csum(buf, len);
1754 csum = ip_compute_csum(buf, len); 1754 else
1755 break;
1756 case 0:
1757 csum = cpu_to_be16(crc_t10dif(buf, len)); 1755 csum = cpu_to_be16(crc_t10dif(buf, len));
1758 break; 1756
1759 }
1760 return csum; 1757 return csum;
1761} 1758}
1762 1759
1763static int dif_verify(struct sd_dif_tuple *sdt, const void *data, 1760static int dif_verify(struct sd_dif_tuple *sdt, const void *data,
1764 sector_t sector, u32 ei_lba) 1761 sector_t sector, u32 ei_lba)
1765{ 1762{
1766 u16 csum = dif_compute_csum(data, scsi_debug_sector_size); 1763 __be16 csum = dif_compute_csum(data, scsi_debug_sector_size);
1767 1764
1768 if (sdt->guard_tag != csum) { 1765 if (sdt->guard_tag != csum) {
1769 pr_err("%s: GUARD check failed on sector %lu rcvd 0x%04x, data 0x%04x\n", 1766 pr_err("%s: GUARD check failed on sector %lu rcvd 0x%04x, data 0x%04x\n",
@@ -1841,7 +1838,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec,
1841 sector = start_sec + i; 1838 sector = start_sec + i;
1842 sdt = dif_store(sector); 1839 sdt = dif_store(sector);
1843 1840
1844 if (sdt->app_tag == 0xffff) 1841 if (sdt->app_tag == cpu_to_be16(0xffff))
1845 continue; 1842 continue;
1846 1843
1847 ret = dif_verify(sdt, fake_store(sector), sector, ei_lba); 1844 ret = dif_verify(sdt, fake_store(sector), sector, ei_lba);