Commit da08ef5c authored by Joe Carnuccio's avatar Joe Carnuccio Committed by Martin K. Petersen

qla2xxx: Avoid side effects when using endianizer macros.

Signed-off-by: default avatarJoe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 243de676
...@@ -272,8 +272,8 @@ qla2x00_sysfs_write_nvram(struct file *filp, struct kobject *kobj, ...@@ -272,8 +272,8 @@ qla2x00_sysfs_write_nvram(struct file *filp, struct kobject *kobj,
iter = (uint32_t *)buf; iter = (uint32_t *)buf;
chksum = 0; chksum = 0;
for (cnt = 0; cnt < ((count >> 2) - 1); cnt++) for (cnt = 0; cnt < ((count >> 2) - 1); cnt++, iter++)
chksum += le32_to_cpu(*iter++); chksum += le32_to_cpu(*iter);
chksum = ~chksum + 1; chksum = ~chksum + 1;
*iter = cpu_to_le32(chksum); *iter = cpu_to_le32(chksum);
} else { } else {
......
This diff is collapsed.
...@@ -5125,8 +5125,8 @@ qla24xx_nvram_config(scsi_qla_host_t *vha) ...@@ -5125,8 +5125,8 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
dptr = (uint32_t *)nv; dptr = (uint32_t *)nv;
ha->isp_ops->read_nvram(vha, (uint8_t *)dptr, ha->nvram_base, ha->isp_ops->read_nvram(vha, (uint8_t *)dptr, ha->nvram_base,
ha->nvram_size); ha->nvram_size);
for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++) for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++, dptr++)
chksum += le32_to_cpu(*dptr++); chksum += le32_to_cpu(*dptr);
ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x006a, ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x006a,
"Contents of NVRAM\n"); "Contents of NVRAM\n");
...@@ -5379,8 +5379,8 @@ uint8_t qla27xx_find_valid_image(struct scsi_qla_host *vha) ...@@ -5379,8 +5379,8 @@ uint8_t qla27xx_find_valid_image(struct scsi_qla_host *vha)
wptr = (uint32_t *)(&pri_image_status); wptr = (uint32_t *)(&pri_image_status);
cnt = size; cnt = size;
for (chksum = 0; cnt; cnt--) for (chksum = 0; cnt--; wptr++)
chksum += le32_to_cpu(*wptr++); chksum += le32_to_cpu(*wptr);
if (chksum) { if (chksum) {
ql_dbg(ql_dbg_init, vha, 0x018c, ql_dbg(ql_dbg_init, vha, 0x018c,
"Checksum validation failed for primary image (0x%x)\n", "Checksum validation failed for primary image (0x%x)\n",
...@@ -5407,8 +5407,8 @@ uint8_t qla27xx_find_valid_image(struct scsi_qla_host *vha) ...@@ -5407,8 +5407,8 @@ uint8_t qla27xx_find_valid_image(struct scsi_qla_host *vha)
wptr = (uint32_t *)(&sec_image_status); wptr = (uint32_t *)(&sec_image_status);
cnt = size; cnt = size;
for (chksum = 0; cnt; cnt--) for (chksum = 0; cnt--; wptr++)
chksum += le32_to_cpu(*wptr++); chksum += le32_to_cpu(*wptr);
if (chksum) { if (chksum) {
ql_dbg(ql_dbg_init, vha, 0x018e, ql_dbg(ql_dbg_init, vha, 0x018e,
"Checksum validation failed for secondary image (0x%x)\n", "Checksum validation failed for secondary image (0x%x)\n",
...@@ -6161,8 +6161,8 @@ qla81xx_nvram_config(scsi_qla_host_t *vha) ...@@ -6161,8 +6161,8 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
ha->isp_ops->read_optrom(vha, ha->nvram, ha->flt_region_nvram << 2, ha->isp_ops->read_optrom(vha, ha->nvram, ha->flt_region_nvram << 2,
ha->nvram_size); ha->nvram_size);
dptr = (uint32_t *)nv; dptr = (uint32_t *)nv;
for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++) for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++, dptr++)
chksum += le32_to_cpu(*dptr++); chksum += le32_to_cpu(*dptr);
ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x0111, ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x0111,
"Contents of NVRAM:\n"); "Contents of NVRAM:\n");
......
...@@ -87,8 +87,8 @@ host_to_adap(uint8_t *src, uint8_t *dst, uint32_t bsize) ...@@ -87,8 +87,8 @@ host_to_adap(uint8_t *src, uint8_t *dst, uint32_t bsize)
__le32 *odest = (__le32 *) dst; __le32 *odest = (__le32 *) dst;
uint32_t iter = bsize >> 2; uint32_t iter = bsize >> 2;
for (; iter ; iter--) for ( ; iter--; isrc++)
*odest++ = cpu_to_le32(*isrc++); *odest++ = cpu_to_le32(*isrc);
} }
static inline void static inline void
......
...@@ -2759,7 +2759,7 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id, ...@@ -2759,7 +2759,7 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
int rval; int rval;
mbx_cmd_t mc; mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc; mbx_cmd_t *mcp = &mc;
uint32_t *siter, *diter, dwords; uint32_t *iter, dwords;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1084, ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1084,
...@@ -2801,9 +2801,9 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id, ...@@ -2801,9 +2801,9 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
"Done %s.\n", __func__); "Done %s.\n", __func__);
dwords = offsetof(struct link_statistics, dwords = offsetof(struct link_statistics,
link_up_cnt) / 4; link_up_cnt) / 4;
siter = diter = &stats->link_fail_cnt; iter = &stats->link_fail_cnt;
while (dwords--) for ( ; dwords--; iter++)
*diter++ = le32_to_cpu(*siter++); le32_to_cpus(iter);
} }
} else { } else {
/* Failed. */ /* Failed. */
...@@ -2820,7 +2820,7 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats, ...@@ -2820,7 +2820,7 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats,
int rval; int rval;
mbx_cmd_t mc; mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc; mbx_cmd_t *mcp = &mc;
uint32_t *siter, *diter, dwords; uint32_t *iter, dwords;
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1088, ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1088,
"Entered %s.\n", __func__); "Entered %s.\n", __func__);
...@@ -2849,9 +2849,9 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats, ...@@ -2849,9 +2849,9 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats,
"Done %s.\n", __func__); "Done %s.\n", __func__);
/* Copy over data -- firmware data is LE. */ /* Copy over data -- firmware data is LE. */
dwords = sizeof(struct link_statistics) / 4; dwords = sizeof(struct link_statistics) / 4;
siter = diter = &stats->link_fail_cnt; iter = &stats->link_fail_cnt;
while (dwords--) for ( ; dwords--; iter++)
*diter++ = le32_to_cpu(*siter++); le32_to_cpus(iter);
} }
} else { } else {
/* Failed. */ /* Failed. */
......
...@@ -610,8 +610,8 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start) ...@@ -610,8 +610,8 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start)
wptr = (uint16_t *)req->ring; wptr = (uint16_t *)req->ring;
cnt = sizeof(struct qla_flt_location) >> 1; cnt = sizeof(struct qla_flt_location) >> 1;
for (chksum = 0; cnt; cnt--) for (chksum = 0; cnt--; wptr++)
chksum += le16_to_cpu(*wptr++); chksum += le16_to_cpu(*wptr);
if (chksum) { if (chksum) {
ql_log(ql_log_fatal, vha, 0x0045, ql_log(ql_log_fatal, vha, 0x0045,
"Inconsistent FLTL detected: checksum=0x%x.\n", chksum); "Inconsistent FLTL detected: checksum=0x%x.\n", chksum);
...@@ -702,8 +702,8 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) ...@@ -702,8 +702,8 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
} }
cnt = (sizeof(struct qla_flt_header) + le16_to_cpu(flt->length)) >> 1; cnt = (sizeof(struct qla_flt_header) + le16_to_cpu(flt->length)) >> 1;
for (chksum = 0; cnt; cnt--) for (chksum = 0; cnt--; wptr++)
chksum += le16_to_cpu(*wptr++); chksum += le16_to_cpu(*wptr);
if (chksum) { if (chksum) {
ql_log(ql_log_fatal, vha, 0x0048, ql_log(ql_log_fatal, vha, 0x0048,
"Inconsistent FLT detected: version=0x%x length=0x%x checksum=0x%x.\n", "Inconsistent FLT detected: version=0x%x length=0x%x checksum=0x%x.\n",
...@@ -930,9 +930,8 @@ qla2xxx_get_fdt_info(scsi_qla_host_t *vha) ...@@ -930,9 +930,8 @@ qla2xxx_get_fdt_info(scsi_qla_host_t *vha)
fdt->sig[3] != 'D') fdt->sig[3] != 'D')
goto no_flash_data; goto no_flash_data;
for (cnt = 0, chksum = 0; cnt < sizeof(struct qla_fdt_layout) >> 1; for (cnt = 0, chksum = 0; cnt < sizeof(*fdt) >> 1; cnt++, wptr++)
cnt++) chksum += le16_to_cpu(*wptr);
chksum += le16_to_cpu(*wptr++);
if (chksum) { if (chksum) {
ql_dbg(ql_dbg_init, vha, 0x004c, ql_dbg(ql_dbg_init, vha, 0x004c,
"Inconsistent FDT detected:" "Inconsistent FDT detected:"
...@@ -1027,7 +1026,8 @@ qla2xxx_get_idc_param(scsi_qla_host_t *vha) ...@@ -1027,7 +1026,8 @@ qla2xxx_get_idc_param(scsi_qla_host_t *vha)
ha->fcoe_dev_init_timeout = QLA82XX_ROM_DEV_INIT_TIMEOUT; ha->fcoe_dev_init_timeout = QLA82XX_ROM_DEV_INIT_TIMEOUT;
ha->fcoe_reset_timeout = QLA82XX_ROM_DRV_RESET_ACK_TIMEOUT; ha->fcoe_reset_timeout = QLA82XX_ROM_DRV_RESET_ACK_TIMEOUT;
} else { } else {
ha->fcoe_dev_init_timeout = le32_to_cpu(*wptr++); ha->fcoe_dev_init_timeout = le32_to_cpu(*wptr);
wptr++;
ha->fcoe_reset_timeout = le32_to_cpu(*wptr); ha->fcoe_reset_timeout = le32_to_cpu(*wptr);
} }
ql_dbg(ql_dbg_init, vha, 0x004e, ql_dbg(ql_dbg_init, vha, 0x004e,
...@@ -1104,10 +1104,9 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha) ...@@ -1104,10 +1104,9 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha)
ha->isp_ops->read_optrom(vha, (uint8_t *)data, ha->isp_ops->read_optrom(vha, (uint8_t *)data,
ha->flt_region_npiv_conf << 2, NPIV_CONFIG_SIZE); ha->flt_region_npiv_conf << 2, NPIV_CONFIG_SIZE);
cnt = (sizeof(struct qla_npiv_header) + le16_to_cpu(hdr.entries) * cnt = (sizeof(hdr) + le16_to_cpu(hdr.entries) * sizeof(*entry)) >> 1;
sizeof(struct qla_npiv_entry)) >> 1; for (wptr = data, chksum = 0; cnt--; wptr++)
for (wptr = data, chksum = 0; cnt; cnt--) chksum += le16_to_cpu(*wptr);
chksum += le16_to_cpu(*wptr++);
if (chksum) { if (chksum) {
ql_dbg(ql_dbg_user, vha, 0x7092, ql_dbg(ql_dbg_user, vha, 0x7092,
"Inconsistent NPIV-Config " "Inconsistent NPIV-Config "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment