aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index e822ca0e97cf..b1b69d738d08 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -61,7 +61,7 @@ static int sg_version_num = 30533; /* 2 digits for each component */
61 61
62#ifdef CONFIG_SCSI_PROC_FS 62#ifdef CONFIG_SCSI_PROC_FS
63#include <linux/proc_fs.h> 63#include <linux/proc_fs.h>
64static char *sg_version_date = "20050328"; 64static char *sg_version_date = "20050901";
65 65
66static int sg_proc_init(void); 66static int sg_proc_init(void);
67static void sg_proc_cleanup(void); 67static void sg_proc_cleanup(void);
@@ -1027,8 +1027,7 @@ sg_ioctl(struct inode *inode, struct file *filp,
1027 if (sdp->detached) 1027 if (sdp->detached)
1028 return -ENODEV; 1028 return -ENODEV;
1029 if (filp->f_flags & O_NONBLOCK) { 1029 if (filp->f_flags & O_NONBLOCK) {
1030 if (test_bit(SHOST_RECOVERY, 1030 if (sdp->device->host->shost_state == SHOST_RECOVERY)
1031 &sdp->device->host->shost_state))
1032 return -EBUSY; 1031 return -EBUSY;
1033 } else if (!scsi_block_when_processing_errors(sdp->device)) 1032 } else if (!scsi_block_when_processing_errors(sdp->device))
1034 return -EBUSY; 1033 return -EBUSY;
@@ -1795,12 +1794,12 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
1795 unsigned long uaddr, size_t count, int rw, 1794 unsigned long uaddr, size_t count, int rw,
1796 unsigned long max_pfn) 1795 unsigned long max_pfn)
1797{ 1796{
1797 unsigned long end = (uaddr + count + PAGE_SIZE - 1) >> PAGE_SHIFT;
1798 unsigned long start = uaddr >> PAGE_SHIFT;
1799 const int nr_pages = end - start;
1798 int res, i, j; 1800 int res, i, j;
1799 unsigned int nr_pages;
1800 struct page **pages; 1801 struct page **pages;
1801 1802
1802 nr_pages = ((uaddr & ~PAGE_MASK) + count + ~PAGE_MASK) >> PAGE_SHIFT;
1803
1804 /* User attempted Overflow! */ 1803 /* User attempted Overflow! */
1805 if ((uaddr + count) < uaddr) 1804 if ((uaddr + count) < uaddr)
1806 return -EINVAL; 1805 return -EINVAL;