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]
Date:	Wed, 4 Apr 2012 14:57:11 -0400
From:	chetan loke <loke.chetan@...il.com>
To:	Nuno Martins <nuno.martins@...xamagica.pt>
Cc:	netdev <netdev@...r.kernel.org>,
	Alfredo Matos <alfredo.matos@...xamagica.pt>,
	Paulo Trezentos <paulo.trezentos@...xamagica.pt>
Subject: Re: [RFC PATCH 2/2] PID-based packet filtering support

On Wed, Apr 4, 2012 at 5:16 AM, Nuno Martins
<nuno.martins@...xamagica.pt> wrote:


> +int get_local_packet_info_from_fd(unsigned int fd, struct packetInfo *ret)

rename 'ret' to 'pi' or pkt_info or pick a name (must match the
struct). And not just here but everywhere else.

> +{
> +       struct file *f = fget(fd);
> +
> +       if (f != NULL) {
> +               fput(f);

why not 'fput' after you return from 'get_local_packet_info_from_file' ?

> +               return get_local_packet_info_from_file(f, ret);
> +       }
> +       return -3;
> +}
> +


> +int get_local_packet_info_from_file(struct file *f, struct packetInfo *ret)
> +{
> +       struct socket *socket = NULL;
> +       short type;
> +       unsigned short family;
> +       int err = 0;
> +
> +       if (f != NULL) {

This check is redundant because the
caller(get_local_packet_info_from_fd) checks for NULL.

Move this function before get_local_packet_info_from_fd().

re-arranged code looks like:

int get_local_packet_info_from_file(...) {
....
}

int get_local_packet_info_from_fd(...) {
   ...
   ... get_local_packet_info_from_file(f, ret);
   ....
}


Chetan
--
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