From patchwork Thu Mar 30 13:43:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arushi Singhal X-Patchwork-Id: 745263 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vv5SQ4wgLz9s1y for ; Fri, 31 Mar 2017 00:43:34 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TKaKUuBc"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933670AbdC3Nne (ORCPT ); Thu, 30 Mar 2017 09:43:34 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35581 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933002AbdC3Nnd (ORCPT ); Thu, 30 Mar 2017 09:43:33 -0400 Received: by mail-pg0-f68.google.com with SMTP id g2so10178355pge.2 for ; Thu, 30 Mar 2017 06:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=HhHI842kOcxmsXXyocEvCxzu7xToIrUpW+4/PUrCuUs=; b=TKaKUuBcwyWNVNUkTx5+XXnjjt+2NNv3lUOBfes0gvGPd3KUWk4+CJs1Ef1C5UKyjm BOmGyH8LRV86sHNbJ5WCpWSJGRPqxIhNUzNepZXVb97tU8ekrCCBLwr/G2N+HAmwnhr4 ThloXND9y7u+cLOc92AKo1hHcpdmsKMWg6gzYkB7zZBToM/l+Bl8dT87svNAPOHyw0gr O+11fjVKi/05QodZXmGo2ZUdwB3llz5yfXqSZ2wCxapGcHUC1okyPPwm8e8uDcXotL0Q TX6VtCbT+9qJQzT7yRXrmSORkUNod6+2gDfVYk3vTLr2miJUeMne55aVdx/dmHHH3a28 3m9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=HhHI842kOcxmsXXyocEvCxzu7xToIrUpW+4/PUrCuUs=; b=oczCiv/vS5Jb4hf/1BVIi9D4JrbD1lDenYmAkDEru/hKkKyUQydr0wIBawIgPIBYcR OdXcQh8rYsJbw1n74CwlO1dei/O+hxzLbf2i2Za1ALwbKtE9Mus4JllqHFBGG8HJsJmj zyIb8M8t50M+A4QbGmMY5PX/1g1IZ2F5SZfQTEQLG3+VO1IddTTPZpjHyFSYUYS39Wok N73aA+gkz5ZlPXOKnNWQfID2QYF3ijPR4gTtY+v6vDVbly+8PNRmJU30TWFZ3/Y3B1L2 5LIa1LUmFZHQL7G34c0KAM290OfdPvU6n8eTEC++f3F3VIJdHOW5+cvyo3QJubkWB7hv rm+A== X-Gm-Message-State: AFeK/H1B5dyr7NzBwoBkTklvXYdnNXpKWsLHiVUDvpy77uabQkhlzkaRF299NQfqHB8BtQ== X-Received: by 10.84.210.228 with SMTP id a91mr7222658pli.120.1490881411837; Thu, 30 Mar 2017 06:43:31 -0700 (PDT) Received: from arushi-HP-Pavilion-Notebook ([14.139.82.6]) by smtp.gmail.com with ESMTPSA id r8sm4849398pfk.80.2017.03.30.06.43.30 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Mar 2017 06:43:30 -0700 (PDT) Date: Thu, 30 Mar 2017 19:13:27 +0530 From: Arushi Singhal To: netfilter-devel@vger.kernel.org Cc: outreachy-kernel@googlegroups.com Subject: [PATCH v2] iptables: extensions: Remove assignments in if condition. Message-ID: <20170330134326.GA30578@arushi-HP-Pavilion-Notebook> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Remove assignments in if condition as reported by checkpatch.pl. Signed-off-by: Arushi Singhal --- change in v2 *remove the error. extensions/libebt_ip.c | 9 ++++++--- extensions/libip6t_ipv6header.c | 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, diff --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)