aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.(none)>2005-08-31 20:27:22 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-09-04 20:45:59 -0400
commit07542b832309b93a2741cd162a391ab909f66438 (patch)
tree4f003966a42737e4ba347589ff15f460072597c5
parent61a7afa2c476a3be261cf88a95b0dea0c3bd29d4 (diff)
This patch fixes in st.c the bug in the signed/unsigned int comparison
reported by Doug Gilbert and fixed by him in sg.c (see [PATCH] sg direct io/mmap oops). Doug fixed the comparison in sg.c. This fix for st.c does not touch the comparison but makes both arguments signed to remove the problem. The new code is adapted from linux/fs/bio.c. Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi> Rejections fixed up and Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/st.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 47a5698a712a..5325cf0ab197 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -17,7 +17,7 @@
17 Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support 17 Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
18 */ 18 */
19 19
20static char *verstr = "20050802"; 20static char *verstr = "20050830";
21 21
22#include <linux/module.h> 22#include <linux/module.h>
23 23
@@ -4444,12 +4444,12 @@ static int st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pag
4444static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages, 4444static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
4445 unsigned long uaddr, size_t count, int rw) 4445 unsigned long uaddr, size_t count, int rw)
4446{ 4446{
4447 unsigned long end = (uaddr + count + PAGE_SIZE - 1) >> PAGE_SHIFT;
4448 unsigned long start = uaddr >> PAGE_SHIFT;
4449 const int nr_pages = end - start;
4447 int res, i, j; 4450 int res, i, j;
4448 unsigned int nr_pages;
4449 struct page **pages; 4451 struct page **pages;
4450 4452
4451 nr_pages = ((uaddr & ~PAGE_MASK) + count + ~PAGE_MASK) >> PAGE_SHIFT;
4452
4453 /* User attempted Overflow! */ 4453 /* User attempted Overflow! */
4454 if ((uaddr + count) < uaddr) 4454 if ((uaddr + count) < uaddr)
4455 return -EINVAL; 4455 return -EINVAL;