Commit e7c2e3b5 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

test_objagg: Uninitialized variable in error handling

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: 9069a381 ("lib: objagg: implement optimization hints assembly and use hints for object creation")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 951d3d6f
...@@ -745,8 +745,10 @@ static int check_expect_stats(struct objagg *objagg, ...@@ -745,8 +745,10 @@ static int check_expect_stats(struct objagg *objagg,
int err; int err;
stats = objagg_stats_get(objagg); stats = objagg_stats_get(objagg);
if (IS_ERR(stats)) if (IS_ERR(stats)) {
*errmsg = "objagg_stats_get() failed.";
return PTR_ERR(stats); return PTR_ERR(stats);
}
err = __check_expect_stats(stats, expect_stats, errmsg); err = __check_expect_stats(stats, expect_stats, errmsg);
objagg_stats_put(stats); objagg_stats_put(stats);
return err; return err;
...@@ -786,7 +788,6 @@ static int test_delta_action_item(struct world *world, ...@@ -786,7 +788,6 @@ static int test_delta_action_item(struct world *world,
if (err) if (err)
goto errout; goto errout;
errmsg = NULL;
err = check_expect_stats(objagg, &action_item->expect_stats, &errmsg); err = check_expect_stats(objagg, &action_item->expect_stats, &errmsg);
if (err) { if (err) {
pr_err("Key %u: Stats: %s\n", action_item->key_id, errmsg); pr_err("Key %u: Stats: %s\n", action_item->key_id, errmsg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment