Skip to content

Commit

Permalink
This patch fixes in st.c the bug in the signed/unsigned int comparison
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
James Bottomley committed Sep 5, 2005
1 parent 61a7afa commit 07542b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/scsi/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
*/

static char *verstr = "20050802";
static char *verstr = "20050830";

#include <linux/module.h>

Expand Down Expand Up @@ -4444,12 +4444,12 @@ static int st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pag
static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
unsigned long uaddr, size_t count, int rw)
{
unsigned long end = (uaddr + count + PAGE_SIZE - 1) >> PAGE_SHIFT;
unsigned long start = uaddr >> PAGE_SHIFT;
const int nr_pages = end - start;
int res, i, j;
unsigned int nr_pages;
struct page **pages;

nr_pages = ((uaddr & ~PAGE_MASK) + count + ~PAGE_MASK) >> PAGE_SHIFT;

/* User attempted Overflow! */
if ((uaddr + count) < uaddr)
return -EINVAL;
Expand Down

0 comments on commit 07542b8

Please sign in to comment.