projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Driver: spi: fix compiling err for rk3288
[firefly-linux-kernel-4.4.55.git]
/
fs
/
squashfs
/
xz_wrapper.c
diff --git
a/fs/squashfs/xz_wrapper.c
b/fs/squashfs/xz_wrapper.c
index c609624e4b8a8cf88152310337c2533be7bec5cb..14cd373e189717ceeef7b1ea66dd0df72d3aec13 100644
(file)
--- a/
fs/squashfs/xz_wrapper.c
+++ b/
fs/squashfs/xz_wrapper.c
@@
-55,7
+55,7
@@
static void *squashfs_xz_comp_opts(struct squashfs_sb_info *msblk,
struct comp_opts *opts;
int err = 0, n;
struct comp_opts *opts;
int err = 0, n;
- opts = kmalloc(sizeof(*opts), GFP_
KERNEL
);
+ opts = kmalloc(sizeof(*opts), GFP_
ATOMIC
);
if (opts == NULL) {
err = -ENOMEM;
goto out2;
if (opts == NULL) {
err = -ENOMEM;
goto out2;
@@
-136,6
+136,7
@@
static int squashfs_xz_uncompress(struct squashfs_sb_info *msblk, void *strm,
enum xz_ret xz_err;
int avail, total = 0, k = 0;
struct squashfs_xz *stream = strm;
enum xz_ret xz_err;
int avail, total = 0, k = 0;
struct squashfs_xz *stream = strm;
+ void *buf = NULL;
xz_dec_reset(stream->state);
stream->buf.in_pos = 0;
xz_dec_reset(stream->state);
stream->buf.in_pos = 0;
@@
-156,12
+157,20
@@
static int squashfs_xz_uncompress(struct squashfs_sb_info *msblk, void *strm,
if (stream->buf.out_pos == stream->buf.out_size) {
stream->buf.out = squashfs_next_page(output);
if (stream->buf.out_pos == stream->buf.out_size) {
stream->buf.out = squashfs_next_page(output);
- if (
stream->buf.out != NULL
) {
+ if (
!IS_ERR(stream->buf.out)
) {
stream->buf.out_pos = 0;
total += PAGE_CACHE_SIZE;
}
}
stream->buf.out_pos = 0;
total += PAGE_CACHE_SIZE;
}
}
+ if (!stream->buf.out) {
+ if (!buf) {
+ buf = kmalloc(PAGE_CACHE_SIZE, GFP_ATOMIC);
+ if (!buf)
+ goto out;
+ }
+ stream->buf.out = buf;
+ }
xz_err = xz_dec_run(stream->state, &stream->buf);
if (stream->buf.in_pos == stream->buf.in_size && k < b)
xz_err = xz_dec_run(stream->state, &stream->buf);
if (stream->buf.in_pos == stream->buf.in_size && k < b)
@@
-173,11
+182,13
@@
static int squashfs_xz_uncompress(struct squashfs_sb_info *msblk, void *strm,
if (xz_err != XZ_STREAM_END || k < b)
goto out;
if (xz_err != XZ_STREAM_END || k < b)
goto out;
+ kfree(buf);
return total + stream->buf.out_pos;
out:
for (; k < b; k++)
put_bh(bh[k]);
return total + stream->buf.out_pos;
out:
for (; k < b; k++)
put_bh(bh[k]);
+ kfree(buf);
return -EIO;
}
return -EIO;
}