[PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 lib/objagg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
 
-- 
2.17.1



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux