lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230525232340.38367-1-minhuadotchen@gmail.com>
Date:   Fri, 26 May 2023 07:23:38 +0800
From:   Min-Hua Chen <minhuadotchen@...il.com>
To:     Kashyap Desai <kashyap.desai@...adcom.com>,
        Sumit Saxena <sumit.saxena@...adcom.com>,
        Shivasharan S <shivasharan.srikanteshwara@...adcom.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
Cc:     Min-Hua Chen <minhuadotchen@...il.com>,
        megaraidlinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] scsi: megaraid: use correct types for __le32 and __le16

This patch fixes several sparse warnings.
No functional changes.

drivers/scsi/megaraid/megaraid_sas_base.c:294:31: sparse: warning: restricted __le16 degrades to integer
drivers/scsi/megaraid/megaraid_sas_base.c:7579:44: sparse: warning: restricted __le32 degrades to integer
drivers/scsi/megaraid/megaraid_sas_base.c:8805:46: sparse: warning: restricted __le32 degrades to integer
drivers/scsi/megaraid/megaraid_sas_fp.c:1188:28: sparse: warning: restricted __le16 degrades to integer

Signed-off-by: Min-Hua Chen <minhuadotchen@...il.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 6 +++---
 drivers/scsi/megaraid/megaraid_sas_fp.c   | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 317c944c68e3..70ac7d1da2ad 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -291,7 +291,7 @@ void megasas_set_dma_settings(struct megasas_instance *instance,
 	if (instance->consistent_mask_64bit) {
 		dcmd->sgl.sge64[0].phys_addr = cpu_to_le64(dma_addr);
 		dcmd->sgl.sge64[0].length = cpu_to_le32(dma_len);
-		dcmd->flags = cpu_to_le16(dcmd->flags | MFI_FRAME_SGL64);
+		dcmd->flags = cpu_to_le16(le16_to_cpu(dcmd->flags) | MFI_FRAME_SGL64);
 
 	} else {
 		dcmd->sgl.sge32[0].phys_addr =
@@ -7576,7 +7576,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 	 * Trigger SCSI to scan our drives
 	 */
 	if (!instance->enable_fw_dev_list ||
-	    (instance->host_device_list_buf->count > 0))
+	    (le32_to_cpu(instance->host_device_list_buf->count) > 0))
 		scsi_scan_host(host);
 
 	/*
@@ -8802,7 +8802,7 @@ void megasas_add_remove_devices(struct megasas_instance *instance,
 
 	if (instance->enable_fw_dev_list) {
 		targetid_list = instance->host_device_list_buf;
-		for (i = 0; i < targetid_list->count; i++) {
+		for (i = 0; i < le32_to_cpu(targetid_list->count); i++) {
 			targetid_entry = &targetid_list->host_device_list[i];
 			if (targetid_entry->flags.u.bits.is_sys_pd) {
 				channel = le16_to_cpu(targetid_entry->target_id) /
diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c
index 4463a538102a..11d16fd128c6 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -1185,7 +1185,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
 					ref_in_start_stripe, io_info,
 					pRAID_Context, map);
 		/* If IO on an invalid Pd, then FP is not possible.*/
-		if (io_info->devHandle == MR_DEVHANDLE_INVALID)
+		if (io_info->devHandle == cpu_to_le16(MR_DEVHANDLE_INVALID))
 			io_info->fpOkForIo = false;
 		return retval;
 	} else if (isRead) {
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ