
From: Chenghai Huang <huangchenghai2@huawei.com> Bit length check for byte alignment and length verification has been completed earlier, so there is no need to check whether the read exceeds the length. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Qi Tao <taoqi10@huawei.com> --- drv/hisi_comp_huf.c | 9 ++------- v1/drv/hisi_zip_huf.c | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/drv/hisi_comp_huf.c b/drv/hisi_comp_huf.c index b9c7f258..3684a187 100644 --- a/drv/hisi_comp_huf.c +++ b/drv/hisi_comp_huf.c @@ -96,15 +96,10 @@ static int check_store_huffman_block(struct bit_reader *br) /* go to a byte boundary */ pad = bit_len & BYTE_ALIGN_MASK; bit_len -= pad; - data = read_bits(br, pad); - if (data < 0) - return BLOCK_IS_INCOMPLETE; - - data = read_bits(br, bit_len); - if (data < 0) - return BLOCK_IS_INCOMPLETE; + br->cur_pos += pad; /* check len and nlen */ + data = read_bits(br, bit_len); if (LEN_NLEN_CHECK(data)) return -WD_EINVAL; diff --git a/v1/drv/hisi_zip_huf.c b/v1/drv/hisi_zip_huf.c index dce9eaf6..086fa9f3 100644 --- a/v1/drv/hisi_zip_huf.c +++ b/v1/drv/hisi_zip_huf.c @@ -96,15 +96,10 @@ static int check_store_huffman_block(struct bit_reader *br) /* go to a byte boundary */ pad = bits & BYTE_ALIGN_MASK; bits -= pad; - data = read_bits(br, pad); - if (data < 0) - return HF_BLOCK_IS_INCOMPLETE; - - data = read_bits(br, bits); - if (data < 0) - return HF_BLOCK_IS_INCOMPLETE; + br->cur_pos += pad; /* check len and nlen */ + data = read_bits(br, bits); if (LEN_NLEN_CHECK(data)) return -WD_EINVAL; -- 2.33.0