Skip to content

Commit

Permalink
NFS: Fix a use-before-initialised warning in fs/nfs/write.c and fs/nf…
Browse files Browse the repository at this point in the history
…s/pnfs.c

If the allocation of nfs_write_header fails, the list of nfs_pages that
needs to be cleaned up is still on desc->pg_list...

Reported-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Fred Isaman <iisaman@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Apr 27, 2012
1 parent 80a16b2 commit 9b5415b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)

whdr = nfs_writehdr_alloc();
if (!whdr) {
desc->pg_completion_ops->error_cleanup(&hdr->pages);
desc->pg_completion_ops->error_cleanup(&desc->pg_list);
put_lseg(desc->pg_lseg);
desc->pg_lseg = NULL;
return -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ static int nfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)

whdr = nfs_writehdr_alloc();
if (!whdr) {
desc->pg_completion_ops->error_cleanup(&hdr->pages);
desc->pg_completion_ops->error_cleanup(&desc->pg_list);
return -ENOMEM;
}
hdr = &whdr->header;
Expand Down

0 comments on commit 9b5415b

Please sign in to comment.