diff options
| author | Daniel Rosenberg <drosen@google.com> | 2017-02-10 16:04:50 -0800 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-11 11:00:29 +0200 |
| commit | d0c9b3a66a5a0ebf2f386153f3a64644055a89e0 (patch) | |
| tree | 86b5354c822f315307c0403b569e03a0ca595542 | |
| parent | f112aed229cc9f2ecd3cff2590a3ac85541562d8 (diff) | |
ANDROID: Squashfs: fix missing NULL check
"Squashfs: refactor page_actor" missed a null check within
squashfs_bh_to_actor, as that array may now contain null entries
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35257858
Change-Id: Ia6748af980859237a96f509f35903f722a46fd59
| -rw-r--r-- | fs/squashfs/page_actor.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/squashfs/page_actor.c b/fs/squashfs/page_actor.c index ee1ade20f..fc1f79151 100644 --- a/fs/squashfs/page_actor.c +++ b/fs/squashfs/page_actor.c @@ -85,13 +85,15 @@ void squashfs_bh_to_actor(struct buffer_head **bh, int nr_buffers, while (pgoff < PAGE_SIZE && bytes < length) { avail = min_t(int, blksz - offset, PAGE_SIZE - pgoff); - memcpy(kaddr + pgoff, bh[b]->b_data + offset, - avail); + if (bh[b]) + memcpy(kaddr + pgoff, bh[b]->b_data + offset, + avail); pgoff += avail; bytes += avail; offset = (offset + avail) % blksz; if (!offset) { - put_bh(bh[b]); + if (bh[b]) + put_bh(bh[b]); ++b; } } |
