netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2 0/2] dcb: some misc fixes
@ 2021-05-01 16:39 Andrea Claudi
  2021-05-01 16:39 ` [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show Andrea Claudi
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andrea Claudi @ 2021-05-01 16:39 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern

This series fixes two issues on dcb code:
- patch 1 fixes an incorrect return value in dcb_cmd_app_show() if an
  incorrect argument is provided;
- patch 2 is a trivial fix for a memory leak when "dcb help" is
  executed.

Andrea Claudi (2):
  dcb: fix return value on dcb_cmd_app_show
  dcb: fix memory leak

 dcb/dcb.c     | 3 ++-
 dcb/dcb_app.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show
  2021-05-01 16:39 [PATCH iproute2 0/2] dcb: some misc fixes Andrea Claudi
@ 2021-05-01 16:39 ` Andrea Claudi
  2021-05-05  8:39   ` Petr Machata
  2021-05-06 14:48   ` David Ahern
  2021-05-01 16:39 ` [PATCH iproute2 2/2] dcb: fix memory leak Andrea Claudi
  2021-05-03 14:49 ` [PATCH iproute2 0/2] dcb: some misc fixes David Ahern
  2 siblings, 2 replies; 7+ messages in thread
From: Andrea Claudi @ 2021-05-01 16:39 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern

dcb_cmd_app_show() is supposed to return EINVAL if an incorrect argument
is provided.

Fixes: 8e9bed1493f5 ("dcb: Add a subtool for the DCB APP object")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 dcb/dcb_app.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
index c4816bc2..28f40614 100644
--- a/dcb/dcb_app.c
+++ b/dcb/dcb_app.c
@@ -667,7 +667,7 @@ static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **a
 out:
 	close_json_object();
 	dcb_app_table_fini(&tab);
-	return 0;
+	return ret;
 }
 
 static int dcb_cmd_app_flush(struct dcb *dcb, const char *dev, int argc, char **argv)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH iproute2 2/2] dcb: fix memory leak
  2021-05-01 16:39 [PATCH iproute2 0/2] dcb: some misc fixes Andrea Claudi
  2021-05-01 16:39 ` [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show Andrea Claudi
@ 2021-05-01 16:39 ` Andrea Claudi
  2021-05-05  8:33   ` Petr Machata
  2021-05-03 14:49 ` [PATCH iproute2 0/2] dcb: some misc fixes David Ahern
  2 siblings, 1 reply; 7+ messages in thread
From: Andrea Claudi @ 2021-05-01 16:39 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern

main() dinamically allocates dcb, but when dcb_help() is called it
returns without freeing it.

Fix this using a goto, as it is already done in the same function.

Fixes: 67033d1c1c8a ("Add skeleton of a new tool, dcb")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 dcb/dcb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dcb/dcb.c b/dcb/dcb.c
index 64a9ef02..696f00e4 100644
--- a/dcb/dcb.c
+++ b/dcb/dcb.c
@@ -571,7 +571,8 @@ int main(int argc, char **argv)
 			break;
 		case 'h':
 			dcb_help();
-			return 0;
+			ret = EXIT_SUCCESS;
+			goto dcb_free;
 		default:
 			fprintf(stderr, "Unknown option.\n");
 			dcb_help();
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH iproute2 0/2] dcb: some misc fixes
  2021-05-01 16:39 [PATCH iproute2 0/2] dcb: some misc fixes Andrea Claudi
  2021-05-01 16:39 ` [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show Andrea Claudi
  2021-05-01 16:39 ` [PATCH iproute2 2/2] dcb: fix memory leak Andrea Claudi
@ 2021-05-03 14:49 ` David Ahern
  2 siblings, 0 replies; 7+ messages in thread
From: David Ahern @ 2021-05-03 14:49 UTC (permalink / raw)
  To: Andrea Claudi, netdev, Petr Machata; +Cc: stephen

On 5/1/21 10:39 AM, Andrea Claudi wrote:
> This series fixes two issues on dcb code:
> - patch 1 fixes an incorrect return value in dcb_cmd_app_show() if an
>   incorrect argument is provided;
> - patch 2 is a trivial fix for a memory leak when "dcb help" is
>   executed.
> 
> Andrea Claudi (2):
>   dcb: fix return value on dcb_cmd_app_show
>   dcb: fix memory leak
> 
>  dcb/dcb.c     | 3 ++-
>  dcb/dcb_app.c | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 

Always cc author of Fixes commit

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH iproute2 2/2] dcb: fix memory leak
  2021-05-01 16:39 ` [PATCH iproute2 2/2] dcb: fix memory leak Andrea Claudi
@ 2021-05-05  8:33   ` Petr Machata
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Machata @ 2021-05-05  8:33 UTC (permalink / raw)
  To: Andrea Claudi; +Cc: netdev, stephen, dsahern


Andrea Claudi <aclaudi@redhat.com> writes:

> main() dinamically allocates dcb, but when dcb_help() is called it
> returns without freeing it.
>
> Fix this using a goto, as it is already done in the same function.
>
> Fixes: 67033d1c1c8a ("Add skeleton of a new tool, dcb")
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>

Thanks!

Reviewed-by: Petr Machata <me@pmachata.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show
  2021-05-01 16:39 ` [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show Andrea Claudi
@ 2021-05-05  8:39   ` Petr Machata
  2021-05-06 14:48   ` David Ahern
  1 sibling, 0 replies; 7+ messages in thread
From: Petr Machata @ 2021-05-05  8:39 UTC (permalink / raw)
  To: Andrea Claudi; +Cc: netdev, stephen, dsahern


Andrea Claudi <aclaudi@redhat.com> writes:

> dcb_cmd_app_show() is supposed to return EINVAL if an incorrect argument
> is provided.
>
> Fixes: 8e9bed1493f5 ("dcb: Add a subtool for the DCB APP object")
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
> ---
>  dcb/dcb_app.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
> index c4816bc2..28f40614 100644
> --- a/dcb/dcb_app.c
> +++ b/dcb/dcb_app.c
> @@ -667,7 +667,7 @@ static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **a
>  out:
>  	close_json_object();
>  	dcb_app_table_fini(&tab);
> -	return 0;
> +	return ret;
>  }
>  
>  static int dcb_cmd_app_flush(struct dcb *dcb, const char *dev, int argc, char **argv)

Nice catch. Looks good,

Reviewed-by: Petr Machata <me@pmachata.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show
  2021-05-01 16:39 ` [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show Andrea Claudi
  2021-05-05  8:39   ` Petr Machata
@ 2021-05-06 14:48   ` David Ahern
  1 sibling, 0 replies; 7+ messages in thread
From: David Ahern @ 2021-05-06 14:48 UTC (permalink / raw)
  To: Andrea Claudi, netdev; +Cc: stephen

On 5/1/21 10:39 AM, Andrea Claudi wrote:
> dcb_cmd_app_show() is supposed to return EINVAL if an incorrect argument
> is provided.
> 
> Fixes: 8e9bed1493f5 ("dcb: Add a subtool for the DCB APP object")
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
> ---
>  dcb/dcb_app.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

applied both


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-06 14:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-01 16:39 [PATCH iproute2 0/2] dcb: some misc fixes Andrea Claudi
2021-05-01 16:39 ` [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show Andrea Claudi
2021-05-05  8:39   ` Petr Machata
2021-05-06 14:48   ` David Ahern
2021-05-01 16:39 ` [PATCH iproute2 2/2] dcb: fix memory leak Andrea Claudi
2021-05-05  8:33   ` Petr Machata
2021-05-03 14:49 ` [PATCH iproute2 0/2] dcb: some misc fixes David Ahern

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).