Skip to content

Commit

Permalink
virtio-fs: fix allocation failure condition
Browse files Browse the repository at this point in the history
Signed-off-by: Fotis Xenakis <[email protected]>
Message-Id: <AM0PR03MB62923313E325B75908C1C3ADA67A0@AM0PR03MB6292.eurprd03.prod.outlook.com>
  • Loading branch information
foxeng authored and wkozaczuk committed Jul 22, 2020
1 parent ccef5ca commit a6fb0d6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fs/virtiofs/virtiofs_vnops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static int virtiofs_lookup(struct vnode* vnode, char* name, struct vnode** vpp)
}

if (!S_ISDIR(inode->attr.mode)) {
kprintf("[virtiofs] inode:%lld, ABORTED lookup of %s because not a "
kprintf("[virtiofs] inode %lld, ABORTED lookup of %s because not a "
"directory\n", inode->nodeid, name);
return ENOTDIR;
}
Expand All @@ -64,7 +64,7 @@ static int virtiofs_lookup(struct vnode* vnode, char* name, struct vnode** vpp)
inode->nodeid, in_args.get(), in_args_len, out_args.get(),
sizeof(*out_args));
if (error) {
kprintf("[virtiofs] inode:%lld, lookup failed to find %s\n",
kprintf("[virtiofs] inode %lld, lookup failed to find %s\n",
inode->nodeid, name);
// TODO: Implement proper error handling by sending FUSE_FORGET
return error;
Expand All @@ -73,7 +73,7 @@ static int virtiofs_lookup(struct vnode* vnode, char* name, struct vnode** vpp)
struct vnode* vp;
// TODO OPT: Should we even use the cache? (consult spec on metadata)
if (vget(vnode->v_mount, out_args->nodeid, &vp) == 1) {
virtiofs_debug("lookup found vp in cache!\n");
virtiofs_debug("lookup found vp in cache\n");
*vpp = vp;
return 0;
}
Expand All @@ -83,7 +83,7 @@ static int virtiofs_lookup(struct vnode* vnode, char* name, struct vnode** vpp)
return ENOMEM;
}
new_inode->nodeid = out_args->nodeid;
virtiofs_debug("inode %lld, lookup found inode %lld for %s!\n",
virtiofs_debug("inode %lld, lookup found inode %lld for %s\n",
inode->nodeid, new_inode->nodeid, name);
memcpy(&new_inode->attr, &out_args->attr, sizeof(out_args->attr));

Expand Down Expand Up @@ -196,7 +196,7 @@ static int virtiofs_read_fallback(virtiofs_inode& inode, u64 file_handle,
std::unique_ptr<void, std::function<void(void*)>> buf {
memory::alloc_phys_contiguous_aligned(read_amt,
alignof(std::max_align_t)), memory::free_phys_contiguous_aligned };
if (!in_args | !buf) {
if (!in_args || !buf) {
return ENOMEM;
}
in_args->fh = file_handle;
Expand Down

0 comments on commit a6fb0d6

Please sign in to comment.