diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2019-02-13 11:56:50 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-13 22:13:29 -0800 |
commit | 4446eb8dbeb223031fb652dd1e58e59d3d4b4aba (patch) | |
tree | 1f482431de21a4480dcb6accb19886058f160e46 /lib/objagg.c | |
parent | f8b1f9f6459c8274865ef819bdedead577096254 (diff) | |
download | linux-4446eb8dbeb223031fb652dd1e58e59d3d4b4aba.tar.bz2 |
lib: objagg: Fix an error code in objagg_hints_get()
We need to set the error code on this path otherwise we return
ERR_PTR(0) which would result in a NULL dereference in the caller.
Fixes: 9069a3817d82 ("lib: objagg: implement optimization hints assembly and use hints for object creation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/objagg.c')
-rw-r--r-- | lib/objagg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/objagg.c b/lib/objagg.c index 781f41c3c47d..d552ec9c60ed 100644 --- a/lib/objagg.c +++ b/lib/objagg.c @@ -968,8 +968,10 @@ struct objagg_hints *objagg_hints_get(struct objagg *objagg, if (err) goto err_fillup_hints; - if (WARN_ON(objagg_hints->node_count != objagg->obj_count)) + if (WARN_ON(objagg_hints->node_count != objagg->obj_count)) { + err = -EINVAL; goto err_node_count_check; + } return objagg_hints; |