--- linux/drivers/scsi/sg.c 2005-08-29 18:28:23.000000000 +1000 +++ linux/drivers/scsi/sg.c2613mm 2005-08-30 15:09:04.000000000 +1000 @@ -61,7 +61,7 @@ #ifdef CONFIG_SCSI_PROC_FS #include -static char *sg_version_date = "20050328"; +static char *sg_version_date = "20050830"; static int sg_proc_init(void); static void sg_proc_cleanup(void); @@ -1831,7 +1831,8 @@ up_read(¤t->mm->mmap_sem); /* Errors and no page mapped should return here */ - if (res < nr_pages) + /* Beware of signed to unsigned integer promotions!! */ + if ((res < 0) || (res < nr_pages)) goto out_unmap; for (i=0; i < nr_pages; i++) {