VFS: fix new signed/unsigned comparisons

This commit is contained in:
Thomas Veerman 2012-04-02 15:16:44 +00:00
parent defe329519
commit b956493367
6 changed files with 16 additions and 9 deletions

View file

@ -297,13 +297,18 @@ static void dump_segments(struct filp *f, Elf_Phdr phdrs[], int phnum)
len = phdrs[i].p_memsz;
seg_off = phdrs[i].p_vaddr;
for (off = 0; off < len; off += CLICK_SIZE) {
if (len > LONG_MAX) {
printf("VFS: segment too large to dump, truncating\n");
len = LONG_MAX;
}
for (off = 0; off < (off_t) len; off += CLICK_SIZE) {
r = sys_vircopy(fp->fp_endpoint, D,
(vir_bytes) (seg_off + off),
SELF, D, (vir_bytes) buf,
(phys_bytes) CLICK_SIZE);
write_buf(f, (char *) buf, (off + CLICK_SIZE <= len) ?
write_buf(f, (char *) buf, (off + CLICK_SIZE <= (off_t) len) ?
CLICK_SIZE : (len - off));
}
}

View file

@ -523,7 +523,8 @@ int replace
* pointers are really offsets from the start of stack.
* Return true iff the operation succeeded.
*/
int offset, a0, a1;
int offset;
vir_bytes a0, a1;
size_t old_bytes = *stk_bytes;
/* Prepending arg adds at least one string and a zero byte. */
@ -624,7 +625,8 @@ phys_bytes seg_bytes /* how much is to be transferred? */
assert((seg == T)||(seg == D));
/* Make sure that the file is big enough */
if (vp->v_size < off+seg_bytes) return(EIO);
if (off + seg_bytes > LONG_MAX) return(EIO);
if ((unsigned long) vp->v_size < off+seg_bytes) return(EIO);
if (seg == T) {
/* We have to use a copy loop until safecopies support segments */

View file

@ -316,7 +316,7 @@ void vmnt_unmap_by_endpt(endpoint_t proc_e);
void check_vnode_locks(void);
void check_vnode_locks_by_me(struct fproc *rfp);
struct vnode *get_free_vnode(void);
struct vnode *find_vnode(int fs_e, int numb);
struct vnode *find_vnode(int fs_e, ino_t inode);
void init_vnodes(void);
int is_vnode_locked(struct vnode *vp);
int lock_vnode(struct vnode *vp, tll_access_t locktype);

View file

@ -145,7 +145,7 @@ int do_select(void)
/* Verify that file descriptors are okay to select on */
for (fd = 0; fd < nfds; fd++) {
struct filp *f;
int type, ops;
unsigned int type, ops;
/* Because the select() interface implicitly includes file descriptors
* you might not want to select on, we have to figure out whether we're
@ -311,7 +311,7 @@ static int is_pipe(struct filp *f)
static int is_supported_major(struct filp *f)
{
/* See if this filp is a handle on a device on which we support select() */
int m;
unsigned int m;
if (!(f && f->filp_vno)) return(FALSE);
if ((f->filp_vno->v_mode & I_TYPE) != I_CHAR_SPECIAL) return(FALSE);

View file

@ -44,7 +44,7 @@ inline int copy_name( size_t len, char *dest)
if (len <= M3_STRING) {
/* Just copy the path from the message */
int count = 0;
unsigned int count = 0;
rpu = &dest[0];
rpm = job_m_in.pathname; /* contained in input message */
for (count = 0; count <= len; count++)

View file

@ -108,7 +108,7 @@ struct vnode *get_free_vnode()
/*===========================================================================*
* find_vnode *
*===========================================================================*/
struct vnode *find_vnode(int fs_e, int ino)
struct vnode *find_vnode(int fs_e, ino_t ino)
{
/* Find a specified (FS endpoint and inode number) vnode in the
* vnode table */