Explorar el Código

[SCSI] libsas: fix test for negative unsigned and typos

unsigned req->data_len cannot be negative, and fix =-/-= typo

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Roel Kluin hace 16 años
padre
commit
a234b1103f
Se han modificado 1 ficheros con 6 adiciones y 6 borrados
  1. 6 6
      drivers/scsi/libsas/sas_host_smp.c

+ 6 - 6
drivers/scsi/libsas/sas_host_smp.c

@@ -199,8 +199,8 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req,
 		break;
 		break;
 
 
 	case SMP_DISCOVER:
 	case SMP_DISCOVER:
-		req->data_len =- 16;
-		if (req->data_len < 0) {
+		req->data_len -= 16;
+		if ((int)req->data_len < 0) {
 			req->data_len = 0;
 			req->data_len = 0;
 			error = -EINVAL;
 			error = -EINVAL;
 			goto out;
 			goto out;
@@ -215,8 +215,8 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req,
 		break;
 		break;
 
 
 	case SMP_REPORT_PHY_SATA:
 	case SMP_REPORT_PHY_SATA:
-		req->data_len =- 16;
-		if (req->data_len < 0) {
+		req->data_len -= 16;
+		if ((int)req->data_len < 0) {
 			req->data_len = 0;
 			req->data_len = 0;
 			error = -EINVAL;
 			error = -EINVAL;
 			goto out;
 			goto out;
@@ -238,8 +238,8 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req,
 		break;
 		break;
 
 
 	case SMP_PHY_CONTROL:
 	case SMP_PHY_CONTROL:
-		req->data_len =- 44;
-		if (req->data_len < 0) {
+		req->data_len -= 44;
+		if ((int)req->data_len < 0) {
 			req->data_len = 0;
 			req->data_len = 0;
 			error = -EINVAL;
 			error = -EINVAL;
 			goto out;
 			goto out;