summaryrefslogtreecommitdiff
blob: 62831bdb79bd99ee9920e9e1862e284295029900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- ./drivers/scsi/ips.c.x	2005-11-14 17:39:58.567273344 +0300
+++ ./drivers/scsi/ips.c	2005-11-14 17:39:33.028155880 +0300
@@ -3657,13 +3657,15 @@ ips_scmd_buf_write(Scsi_Cmnd * scmd, voi
 		unsigned int min_cnt, xfer_cnt;
 		char *cdata = (char *) data;
 		struct scatterlist *sg = scmd->request_buffer;
+		void *sga;
+
 		for (i = 0, xfer_cnt = 0;
 		     (i < scmd->use_sg) && (xfer_cnt < count); i++) {
-			if (!IPS_SG_ADDRESS(&sg[i]))
+			sga = IPS_SG_ADDRESS(&sg[i]);
+			if (!sga)
 				return;
 			min_cnt = min(count - xfer_cnt, sg[i].length);
-			memcpy(IPS_SG_ADDRESS(&sg[i]), &cdata[xfer_cnt],
-			       min_cnt);
+			memcpy(sga, &cdata[xfer_cnt], min_cnt);
 			xfer_cnt += min_cnt;
 		}
 
@@ -3689,13 +3691,15 @@ ips_scmd_buf_read(Scsi_Cmnd * scmd, void
 		unsigned int min_cnt, xfer_cnt;
 		char *cdata = (char *) data;
 		struct scatterlist *sg = scmd->request_buffer;
+		void *sga;
+
 		for (i = 0, xfer_cnt = 0;
 		     (i < scmd->use_sg) && (xfer_cnt < count); i++) {
-			if (!IPS_SG_ADDRESS(&sg[i]))
+			sga = IPS_SG_ADDRESS(&sg[i]);
+			if (!sga)
 				return;
 			min_cnt = min(count - xfer_cnt, sg[i].length);
-			memcpy(&cdata[xfer_cnt], IPS_SG_ADDRESS(&sg[i]),
-			       min_cnt);
+			memcpy(&cdata[xfer_cnt], sga, min_cnt);
 			xfer_cnt += min_cnt;
 		}