Skip to content

Commit

Permalink
module: Fix NULL vs IS_ERR checking for module_get_next_page
Browse files Browse the repository at this point in the history
[ Upstream commit 45af1d7 ]

The module_get_next_page() function return error pointers on error
instead of NULL.
Use IS_ERR() to check the return value to fix this.

Fixes: b1ae6dc ("module: add in-kernel support for decompressing")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yuuoniy authored and gregkh committed Dec 31, 2022
1 parent 0183b7c commit 7a779e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/module/decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ static ssize_t module_gzip_decompress(struct load_info *info,
do {
struct page *page = module_get_next_page(info);

if (!page) {
retval = -ENOMEM;
if (IS_ERR(page)) {
retval = PTR_ERR(page);
goto out_inflate_end;
}

Expand Down Expand Up @@ -173,8 +173,8 @@ static ssize_t module_xz_decompress(struct load_info *info,
do {
struct page *page = module_get_next_page(info);

if (!page) {
retval = -ENOMEM;
if (IS_ERR(page)) {
retval = PTR_ERR(page);
goto out;
}

Expand Down

0 comments on commit 7a779e8

Please sign in to comment.