Re: memory allocation in sg_io()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 10, 2008 at 02:19:08PM +0100, Oliver Neukum wrote:
> Am Donnerstag, 10. Januar 2008 14:05:25 schrieb Boaz Harrosh:
> > On Thu, Jan 10 2008 at 14:33 +0200, Oliver Neukum <oliver@xxxxxxxxxx> wrote:
> > > Hi,
> > > 
> > > could you explain to me why this code can get away with allocating the
> > > sense buffer on the stack?
> > > 
> > > static int sg_io(struct file *file, struct request_queue *q,
> > > 		struct gendisk *bd_disk, struct sg_io_hdr *hdr)
> > > {
> > > 	unsigned long start_time;
> > > 	int writing = 0, ret = 0, has_write_perm = 0;
> > > 	struct request *rq;
> > > 	char sense[SCSI_SENSE_BUFFERSIZE];
> 
> Yes, you are doing DMA on the stack.

Nobody does DMA to rq->sense.  ub does a memcpy to it.  cciss does a
memcpy to it.  scsi_lib assigns its own buffer to req->sense, ignoring
the one passed down.

That's how this code gets away with it.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux