srb->virt_addr = virt[idx] + (psge->address & ~PAGE_MASK); 
srb->virt_addr = (page_address(sg->page) + psge->address - (psge->address & PAGE_MASK)); 
static void sg_update_list(struct ScsiReqBlk *srb, u32 left){	u8 idx;	struct scatterlist *sg;	struct scsi_cmnd *cmd = srb->cmd;	int segment = cmd->use_sg;	u32 xferred = srb->total_xfer_length - left; /* bytes transfered */	struct SGentry *psge = srb->segment_x + srb->sg_index;	void **virt = srb->virt_map;	dprintkdbg(DBG_0,		"sg_update_list: Transfered %i of %i bytes, %i remain\n",		xferred, srb->total_xfer_length, left);	if (xferred == 0) {		/* nothing to update since we did not transfer any data */		return;	}	sg_verify_length(srb);	srb->total_xfer_length = left;	/* update remaining count */	for (idx = srb->sg_index; idx < srb->sg_count; idx++) {		if (xferred >= psge->length) {			/* Complete SG entries done */			xferred -= psge->length;		} else {			/* Partial SG entry done */			psge->length -= xferred;			psge->address += xferred;			srb->sg_index = idx;			pci_dma_sync_single_for_device(srb->dcb->					    acb->dev,					    srb->sg_bus_addr,					    SEGMENTX_LEN,					    PCI_DMA_TODEVICE);			break;		}		psge++;	}	sg_verify_length(srb);	/* we need the corresponding virtual address */	if (!segment) {		srb->virt_addr += xferred;		return;	}	/* We have to walk the scatterlist to find it */	sg = (struct scatterlist *)cmd->request_buffer;	idx = 0;	while (segment--) {		unsigned long mask =		    ~((unsigned long)sg->length - 1) & PAGE_MASK;		if ((sg_dma_address(sg) & mask) == (psge->address & mask)) {			srb->virt_addr = virt[idx] + (psge->address & ~PAGE_MASK);			return;		}		++sg;		++idx;	}	dprintkl(KERN_ERR, "sg_update_list: sg_to_virt failed\n");	srb->virt_addr = NULL;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b4b08e581fac8e0ba9ae348bdc13246c9798c99e/dc395x.c/buggy/drivers/scsi/dc395x.c