* [PATCH v2] iptables: extensions: Remove assignments in if condition.
@ 2017-03-30 13:43 Arushi Singhal
0 siblings, 0 replies; only message in thread
From: Arushi Singhal @ 2017-03-30 13:43 UTC (permalink / raw)
To: netfilter-devel; +Cc: outreachy-kernel
Remove assignments in if condition as reported by checkpatch.pl.
Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
change in v2
*remove the error.
extensions/libebt_ip.c | 9 ++++++---
| 5 +++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/extensions/libebt_ip.c b/extensions/libebt_ip.c
index 4ca63e9..6b301e2 100644
--- a/extensions/libebt_ip.c
+++ b/extensions/libebt_ip.c
@@ -70,7 +70,8 @@ parse_port_range(const char *protocol, const char *portstring, uint16_t *ports)
char *cp;
buffer = strdup(portstring);
- if ((cp = strchr(buffer, ':')) == NULL)
+ cp = strchr(buffer, ':');
+ if (!cp)
ports[0] = ports[1] = xtables_parse_port(buffer, NULL);
else {
*cp = '\0';
@@ -98,7 +99,8 @@ static int undot_ip(char *ip, unsigned char *ip2)
p = buf;
for (i = 0; i < 3; i++) {
- if ((q = strchr(p, '.')) == NULL)
+ q = strchr(p, '.');
+ if (!q)
return -1;
*q = '\0';
onebyte = strtol(p, &end, 10);
@@ -143,7 +145,8 @@ static void ebt_parse_ip_address(char *address, uint32_t *addr, uint32_t *msk)
char *p;
/* first the mask */
- if ((p = strrchr(address, '/')) != NULL) {
+ p = strrchr(address, '/');
+ if (p) {
*p = '\0';
if (ip_mask(p + 1, (unsigned char *)msk)) {
xtables_error(PARAMETER_PROBLEM,
--git a/extensions/libip6t_ipv6header.c b/extensions/libip6t_ipv6header.c
index 6f03087..887d225 100644
--- a/extensions/libip6t_ipv6header.c
+++ b/extensions/libip6t_ipv6header.c
@@ -85,8 +85,9 @@ name_to_proto(const char *s)
unsigned int proto=0;
const struct protoent *pent;
- if ((pent = getprotobyname(s)))
- proto = pent->p_proto;
+ pent = getprotobyname(s);
+ if (pent)
+ proto = pent->p_proto;
else {
unsigned int i;
for (i = 0; i < ARRAY_SIZE(chain_protos); ++i)
--
2.11.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-30 13:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-30 13:43 [PATCH v2] iptables: extensions: Remove assignments in if condition Arushi Singhal
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).