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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 23 Jul 2013 10:26:37 +0800
From:	Cong Wang <amwang@...hat.com>
To:	Joe Perches <joe@...ches.com>
Cc:	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>
Subject: Re: [Patch net-next 0/7] net: introduce generic type and helpers
 for IP address

On Mon, 2013-07-22 at 19:16 -0700, Joe Perches wrote:
> On Tue, 2013-07-23 at 10:00 +0800, Cong Wang wrote:
> > On Mon, 2013-07-22 at 13:44 -0700, Joe Perches wrote:
> > > 
> > > I see no reason why vsprint's support for
> > > "struct sockaddr *" %pIS should be removed.
> > > 
> > > %pIS and %pIA can both exist.
> 
> > Because there is no need to keep both of them, struct sockaddr can be
> > safely converted to union inet_addr.
> 
> That's a bit fragile.
> The cost of keeping %pIS is pretty low.

I knew, but again, there is no need at all.

> 
> Also, if there is ever a check for %p<type>,
> then using:
> 
> 	struct sockaddr *foo = bar;
> 	...
> 	snprintf(buf, len, "%pIA", foo)
> 
> would need foo to be cast first to union inet_addr *
> 
> 	snprintf(buf, len, "%pIA", (union inet_addr *)foo);
> 
> 

You don't have to, compiler doesn't check the new specifier, and it is
safe even without any casting.

What's more, the existing %pIS user (sctp) is already converted to union
inet_addr, see patch 6/7.

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