diff options
author | Julia Lawall <julia@diku.dk> | 2009-08-07 19:51:33 +0200 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-08-07 19:51:33 +0200 |
commit | 60f2e8f8a07331097a57ec4abcdc680405579377 (patch) | |
tree | 6ed3c6c8fc2ad4c824c7d2c942fe7d3ece924dc7 /fs/btrfs/zlib.c | |
parent | Btrfs: remove superfluous NULL pointer check in btrfs_rename() (diff) | |
download | linux-60f2e8f8a07331097a57ec4abcdc680405579377.tar.xz linux-60f2e8f8a07331097a57ec4abcdc680405579377.zip |
Btrfs: correct error-handling zlib error handling
find_zlib_workspace returns an ERR_PTR value in an error case instead of NULL.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@match exists@
expression x, E;
statement S1, S2;
@@
x = find_zlib_workspace(...)
... when != x = E
(
* if (x == NULL || ...) S1 else S2
|
* if (x == NULL && ...) S1 else S2
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to '')
-rw-r--r-- | fs/btrfs/zlib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index ecfbce836d32..3e2b90eaa239 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c @@ -208,7 +208,7 @@ int btrfs_zlib_compress_pages(struct address_space *mapping, *total_in = 0; workspace = find_zlib_workspace(); - if (!workspace) + if (IS_ERR(workspace)) return -1; if (Z_OK != zlib_deflateInit(&workspace->def_strm, 3)) { @@ -366,7 +366,7 @@ int btrfs_zlib_decompress_biovec(struct page **pages_in, char *kaddr; workspace = find_zlib_workspace(); - if (!workspace) + if (IS_ERR(workspace)) return -ENOMEM; data_in = kmap(pages_in[page_in_index]); @@ -547,7 +547,7 @@ int btrfs_zlib_decompress(unsigned char *data_in, return -ENOMEM; workspace = find_zlib_workspace(); - if (!workspace) + if (IS_ERR(workspace)) return -ENOMEM; workspace->inf_strm.next_in = data_in; |