Skip to contentSkip to conversation

libsas: unsigned X cannot be negative

PATCH New roel kluin 1 participant 1 message Oct 29, 2008

Subsystems (2)
lore
Share & tools
lore

roel kluin

author
#0 lore raw

PATCH 1/1 libsas: unsigned X cannot be negative

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

---
I am not sure whether this is what was intended, please review. Also I am unable to respond for a few weeks.

drivers/scsi/libsas/sas_host_smp.c +2 -2
index 16f9312..caf9316 100644
@@ -199,12 +199,12 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req,
 		break;
 
 	case SMP_DISCOVER:
-		req->data_len =- 16;
-		if (req->data_len < 0) {
+		if (req->data_len < 15) {
 			req->data_len = 0;
 			error = -EINVAL;
 			goto out;
 		}
+		req->data_len -= 16;
 		resp_data_len -= 56;
 		sas_host_smp_discover(sas_ha, resp_data, req_data[9]);
 		break;