lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHC9VhQ5C32zRqG0emVUoMmuvBsV+TXvdNn+54iVyCPBNk9dDQ@mail.gmail.com>
Date:	Sat, 31 Jan 2015 21:40:50 -0500
From:	Paul Moore <paul@...l-moore.com>
To:	SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:	"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 3/3] netlabel: Less function calls in netlbl_mgmt_add_common()
 after error detection

On Sat, Jan 31, 2015 at 4:38 PM, SF Markus Elfring
<elfring@...rs.sourceforge.net> wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Sat, 31 Jan 2015 21:55:48 +0100
>
> The functions "cipso_v4_doi_putdef" and "kfree" could be called in some cases
> by the netlbl_mgmt_add_common() function during error handling even if the
> passed variables contained still a null pointer.
>
> * This implementation detail could be improved by adjustments for jump labels.
>
> * Let us return immediately after the first failed function call according to
>   the current Linux coding style convention.
>
> * Let us delete also an unnecessary check for the variable "entry" there.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  net/netlabel/netlabel_mgmt.c | 46 ++++++++++++++++++++++----------------------
>  1 file changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
> index f5807f5..17f1ed5 100644
> --- a/net/netlabel/netlabel_mgmt.c
> +++ b/net/netlabel/netlabel_mgmt.c

...

> @@ -237,15 +235,17 @@ static int netlbl_mgmt_add_common(struct genl_info *info,
>
>         ret_val = netlbl_domhsh_add(entry, audit_info);
>         if (ret_val != 0)
> -               goto add_failure;
> +               goto free_address_map;
>
>         return 0;
>
> -add_failure:
> -       cipso_v4_doi_putdef(cipsov4);
> -       if (entry)
> -               kfree(entry->domain);
> +free_address_map:
>         kfree(addrmap);
> +doi_put_def:
> +       cipso_v4_doi_putdef(cipsov4);
> +free_domain:
> +       kfree(entry->domain);
> +free_entry:
>         kfree(entry);
>         return ret_val;
>  }

It would be nice if you could stick with the goto label naming style
in the rest of the file, e.g.
"add_free_addrmap"/"add_put_doi_def"/"add_free_domain"/"add_free_entry".

-- 
paul moore
www.paul-moore.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ