public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox•net>
To: Vadim Kochan <vadim4j@gmail•com>
Cc: netdev@vger•kernel.org, jose.r.guzman.mosqueda@intel•com
Subject: Re: [PATCH iproute2] ss: Fix allocation of cong control alg name
Date: Fri, 29 May 2015 13:09:40 +0200	[thread overview]
Message-ID: <556848F4.6080003@iogearbox.net> (raw)
In-Reply-To: <1432895400-12266-1-git-send-email-vadim4j@gmail.com>

Hi Vadim,

On 05/29/2015 12:30 PM, Vadim Kochan wrote:
> From: Vadim Kochan <vadim4j@gmail•com>
>
> Use strdup instead of malloc, and get rid of bad strcpy.
>
> Signed-off-by: Vadim Kochan <vadim4j@gmail•com>

Please also Cc the reporter (done here), and add a:

Fixes: 8250bc9ff4e5 ("ss: Unify inet sockets output")
Reported-by: Jose R. Guzman Mosqueda <jose.r.guzman.mosqueda@intel•com>

Fixes tag is _very useful_ for distros to easily identify if additional
follow-up commits would be needed when backporting the original change.
Then, this can be easily identified when going through the git log.

> ---
>   misc/ss.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/misc/ss.c b/misc/ss.c
> index 347e3a1..a719466 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
> @@ -1908,8 +1908,7 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
>
>   		if (tb[INET_DIAG_CONG]) {
>   			const char *cong_attr = rta_getattr_str(tb[INET_DIAG_CONG]);
> -			s.cong_alg = malloc(strlen(cong_attr + 1));
> -			strcpy(s.cong_alg, cong_attr);
> +			s.cong_alg = strdup(cong_attr);

strdup(3) can still return NULL.

>   		}
>
>   		if (TCPI_HAS_OPT(info, TCPI_OPT_WSCALE)) {
>

  parent reply	other threads:[~2015-05-29 11:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29 10:30 [PATCH iproute2] ss: Fix allocation of cong control alg name Vadim Kochan
2015-05-29 11:04 ` Eric Dumazet
2015-05-29 11:11   ` Daniel Borkmann
2015-05-29 12:53   ` Vadim Kochan
2015-05-29 15:15     ` Eric Dumazet
2015-05-29 11:09 ` Daniel Borkmann [this message]
2015-05-29 16:17   ` Guzman Mosqueda, Jose R
2015-05-29 16:48     ` Daniel Borkmann
2015-06-25  3:31       ` Stephen Hemminger
2015-06-25  7:12         ` Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=556848F4.6080003@iogearbox.net \
    --to=daniel@iogearbox$(echo .)net \
    --cc=jose.r.guzman.mosqueda@intel$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=vadim4j@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox