Fix bugs found in MFS by clang static analyzer.
This commit is contained in:
parent
10375d2629
commit
a9a45cddc4
@ -321,12 +321,16 @@ PUBLIC int fs_rename()
|
||||
old_ip = NULL;
|
||||
if (r == EENTERMOUNT) r = EXDEV; /* should this fail at all? */
|
||||
else if (r == ELEAVEMOUNT) r = EINVAL; /* rename on dot-dot */
|
||||
} else if (old_ip == NULL) {
|
||||
return(err_code);
|
||||
}
|
||||
|
||||
/* Get new dir inode */
|
||||
if( (new_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL)
|
||||
r = err_code;
|
||||
else {
|
||||
if( (new_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL) {
|
||||
put_inode(old_ip);
|
||||
put_inode(old_dirp);
|
||||
return(err_code);
|
||||
} else {
|
||||
if (new_dirp->i_nlinks == NO_LINK) { /* Dir does not actually exist */
|
||||
put_inode(old_ip);
|
||||
put_inode(old_dirp);
|
||||
|
@ -30,7 +30,7 @@ PUBLIC int main(int argc, char *argv[])
|
||||
* three major activities: getting new work, processing the work, and
|
||||
* sending the reply. The loop never terminates, unless a panic occurs.
|
||||
*/
|
||||
int error, ind, transid;
|
||||
int error = OK, ind, transid;
|
||||
|
||||
/* SEF local startup. */
|
||||
env_setargs(argc, argv);
|
||||
@ -52,7 +52,6 @@ PUBLIC int main(int argc, char *argv[])
|
||||
assert(IS_VFS_FS_TRANSID(transid));
|
||||
|
||||
src = fs_m_in.m_source;
|
||||
error = OK;
|
||||
caller_uid = INVAL_UID; /* To trap errors */
|
||||
caller_gid = INVAL_GID;
|
||||
req_nr = fs_m_in.m_type;
|
||||
|
@ -466,6 +466,7 @@ unsigned bytes_ahead; /* bytes beyond position for immediate use */
|
||||
|
||||
block = baseblock;
|
||||
bp = get_block(dev, block, PREFETCH);
|
||||
assert(bp != NULL);
|
||||
if (bp->b_dev != NO_DEV) return(bp);
|
||||
|
||||
/* The best guess for the number of blocks to prefetch: A lot.
|
||||
|
@ -27,6 +27,8 @@ int map; /* IMAP (inode map) or ZMAP (zone map) */
|
||||
bit_t i, b;
|
||||
bit_t free_bits;
|
||||
|
||||
assert(sp != NULL);
|
||||
|
||||
if (map == IMAP) {
|
||||
start_block = START_BLOCK;
|
||||
map_bits = (bit_t) (sp->s_ninodes + 1);
|
||||
|
@ -92,7 +92,7 @@ int op; /* special actions */
|
||||
excess = excess % nr_indirects;
|
||||
if (ind_ex >= nr_indirects) return(EFBIG);
|
||||
|
||||
if(z == NO_ZONE) {
|
||||
if(z == NO_ZONE && (op & WMAP_FREE)) {
|
||||
/* WMAP_FREE and no double indirect block - then no
|
||||
* single indirect block either.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user