patch-2.0.8 linux/drivers/scsi/sr.c

Next file: linux/drivers/sound/configure.c
Previous file: linux/drivers/scsi/sd.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.7/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c
@@ -822,9 +822,9 @@
 	    };
 	};
 	SCpnt->use_sg = count;  /* Number of chains */
-	count = 512;/* scsi_malloc can only allocate in chunks of 512 bytes*/
-	while( count < (SCpnt->use_sg * sizeof(struct scatterlist))) 
-	    count = count << 1;
+	/* scsi_malloc can only allocate in chunks of 512 bytes */
+	count  = (SCpnt->use_sg * sizeof(struct scatterlist) + 511) & ~511;
+
 	SCpnt->sglist_len = count;
 	sgpnt = (struct scatterlist * ) scsi_malloc(count);
 	if (!sgpnt) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov