* [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get()
@ 2019-02-13 8:56 Dan Carpenter
2019-02-13 8:58 ` [PATCH 2/3 net-next] test_objagg: Test the correct variable Dan Carpenter
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Dan Carpenter @ 2019-02-13 8:56 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, Ido Schimmel, kernel-janitors
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>
---
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3 net-next] test_objagg: Test the correct variable
2019-02-13 8:56 [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get() Dan Carpenter
@ 2019-02-13 8:58 ` Dan Carpenter
2019-02-13 13:16 ` Jiri Pirko
2019-02-14 6:13 ` David Miller
2019-02-13 8:59 ` [PATCH 3/3 net-next] test_objagg: Uninitialized variable in error handling Dan Carpenter
` (2 subsequent siblings)
3 siblings, 2 replies; 9+ messages in thread
From: Dan Carpenter @ 2019-02-13 8:58 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, kernel-janitors
There is a typo here. We intended to check "objagg2" but we instead
test "objagg" which is not an error pointer.
Fixes: 9069a3817d82 ("lib: objagg: implement optimization hints assembly and use hints for object creation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
lib/test_objagg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/test_objagg.c b/lib/test_objagg.c
index 3744573b6365..3dd45777b13c 100644
--- a/lib/test_objagg.c
+++ b/lib/test_objagg.c
@@ -952,8 +952,8 @@ static int test_hints_case(const struct hints_case *hints_case)
}
objagg2 = objagg_create(&delta_ops, hints, &world2);
- if (IS_ERR(objagg))
- return PTR_ERR(objagg);
+ if (IS_ERR(objagg2))
+ return PTR_ERR(objagg2);
for (i = 0; i < hints_case->key_ids_count; i++) {
objagg_obj = world_obj_get(&world2, objagg2,
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3 net-next] test_objagg: Uninitialized variable in error handling
2019-02-13 8:56 [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get() Dan Carpenter
2019-02-13 8:58 ` [PATCH 2/3 net-next] test_objagg: Test the correct variable Dan Carpenter
@ 2019-02-13 8:59 ` Dan Carpenter
2019-02-13 13:16 ` Jiri Pirko
2019-02-14 6:13 ` David Miller
2019-02-13 13:15 ` [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get() Jiri Pirko
2019-02-14 6:13 ` David Miller
3 siblings, 2 replies; 9+ messages in thread
From: Dan Carpenter @ 2019-02-13 8:59 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, kernel-janitors
We need to set the error message on this path otherwise some of the
callers, such as test_hints_case(), print from an uninitialized pointer.
We had a similar bug earlier and set "errmsg" to NULL in the caller,
test_delta_action_item(). That code is no longer required so I have
removed it.
Fixes: 9069a3817d82 ("lib: objagg: implement optimization hints assembly and use hints for object creation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
lib/test_objagg.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/test_objagg.c b/lib/test_objagg.c
index 3dd45777b13c..72c1abfa154d 100644
--- a/lib/test_objagg.c
+++ b/lib/test_objagg.c
@@ -745,8 +745,10 @@ static int check_expect_stats(struct objagg *objagg,
int err;
stats = objagg_stats_get(objagg);
- if (IS_ERR(stats))
+ if (IS_ERR(stats)) {
+ *errmsg = "objagg_stats_get() failed.";
return PTR_ERR(stats);
+ }
err = __check_expect_stats(stats, expect_stats, errmsg);
objagg_stats_put(stats);
return err;
@@ -786,7 +788,6 @@ static int test_delta_action_item(struct world *world,
if (err)
goto errout;
- errmsg = NULL;
err = check_expect_stats(objagg, &action_item->expect_stats, &errmsg);
if (err) {
pr_err("Key %u: Stats: %s\n", action_item->key_id, errmsg);
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get()
2019-02-13 8:56 [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get() Dan Carpenter
2019-02-13 8:58 ` [PATCH 2/3 net-next] test_objagg: Test the correct variable Dan Carpenter
2019-02-13 8:59 ` [PATCH 3/3 net-next] test_objagg: Uninitialized variable in error handling Dan Carpenter
@ 2019-02-13 13:15 ` Jiri Pirko
2019-02-14 6:13 ` David Miller
3 siblings, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2019-02-13 13:15 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Jiri Pirko, netdev, Ido Schimmel, kernel-janitors
Wed, Feb 13, 2019 at 09:56:50AM CET, dan.carpenter@oracle.com wrote:
>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>
I have the same patch in my queue.
Acked-by: Jiri Pirko <jiri@mellanox.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3 net-next] test_objagg: Test the correct variable
2019-02-13 8:58 ` [PATCH 2/3 net-next] test_objagg: Test the correct variable Dan Carpenter
@ 2019-02-13 13:16 ` Jiri Pirko
2019-02-14 6:13 ` David Miller
1 sibling, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2019-02-13 13:16 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Jiri Pirko, netdev, kernel-janitors
Wed, Feb 13, 2019 at 09:58:20AM CET, dan.carpenter@oracle.com wrote:
>There is a typo here. We intended to check "objagg2" but we instead
>test "objagg" which is not an error pointer.
>
>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>
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3 net-next] test_objagg: Uninitialized variable in error handling
2019-02-13 8:59 ` [PATCH 3/3 net-next] test_objagg: Uninitialized variable in error handling Dan Carpenter
@ 2019-02-13 13:16 ` Jiri Pirko
2019-02-14 6:13 ` David Miller
1 sibling, 0 replies; 9+ messages in thread
From: Jiri Pirko @ 2019-02-13 13:16 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Jiri Pirko, netdev, kernel-janitors
Wed, Feb 13, 2019 at 09:59:31AM CET, dan.carpenter@oracle.com wrote:
>We need to set the error message on this path otherwise some of the
>callers, such as test_hints_case(), print from an uninitialized pointer.
>
>We had a similar bug earlier and set "errmsg" to NULL in the caller,
>test_delta_action_item(). That code is no longer required so I have
>removed it.
>
>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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get()
2019-02-13 8:56 [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get() Dan Carpenter
` (2 preceding siblings ...)
2019-02-13 13:15 ` [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get() Jiri Pirko
@ 2019-02-14 6:13 ` David Miller
3 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2019-02-14 6:13 UTC (permalink / raw)
To: dan.carpenter; +Cc: jiri, netdev, idosch, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 13 Feb 2019 11:56:50 +0300
> 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>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3 net-next] test_objagg: Test the correct variable
2019-02-13 8:58 ` [PATCH 2/3 net-next] test_objagg: Test the correct variable Dan Carpenter
2019-02-13 13:16 ` Jiri Pirko
@ 2019-02-14 6:13 ` David Miller
1 sibling, 0 replies; 9+ messages in thread
From: David Miller @ 2019-02-14 6:13 UTC (permalink / raw)
To: dan.carpenter; +Cc: jiri, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 13 Feb 2019 11:58:20 +0300
> There is a typo here. We intended to check "objagg2" but we instead
> test "objagg" which is not an error pointer.
>
> Fixes: 9069a3817d82 ("lib: objagg: implement optimization hints assembly and use hints for object creation")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3 net-next] test_objagg: Uninitialized variable in error handling
2019-02-13 8:59 ` [PATCH 3/3 net-next] test_objagg: Uninitialized variable in error handling Dan Carpenter
2019-02-13 13:16 ` Jiri Pirko
@ 2019-02-14 6:13 ` David Miller
1 sibling, 0 replies; 9+ messages in thread
From: David Miller @ 2019-02-14 6:13 UTC (permalink / raw)
To: dan.carpenter; +Cc: jiri, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 13 Feb 2019 11:59:31 +0300
> We need to set the error message on this path otherwise some of the
> callers, such as test_hints_case(), print from an uninitialized pointer.
>
> We had a similar bug earlier and set "errmsg" to NULL in the caller,
> test_delta_action_item(). That code is no longer required so I have
> removed it.
>
> Fixes: 9069a3817d82 ("lib: objagg: implement optimization hints assembly and use hints for object creation")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-02-14 6:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-13 8:56 [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get() Dan Carpenter
2019-02-13 8:58 ` [PATCH 2/3 net-next] test_objagg: Test the correct variable Dan Carpenter
2019-02-13 13:16 ` Jiri Pirko
2019-02-14 6:13 ` David Miller
2019-02-13 8:59 ` [PATCH 3/3 net-next] test_objagg: Uninitialized variable in error handling Dan Carpenter
2019-02-13 13:16 ` Jiri Pirko
2019-02-14 6:13 ` David Miller
2019-02-13 13:15 ` [PATCH 1/3 net-next] lib: objagg: Fix an error code in objagg_hints_get() Jiri Pirko
2019-02-14 6:13 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).